@Override protected QueryStatus doFetchStatus(OperationHandle operationHandle) throws HiveSQLException, ExploreException, HandleNotFoundException { try { // In Hive 12, CLIService.getOperationStatus returns OperationState. // In Hive 13, CLIService.getOperationStatus returns OperationStatus. // Since we use Hive 13 for dev, we need the following workaround to get Hive 12 working. Class<? extends CLIService> cliServiceClass = getCliService().getClass(); Method m = cliServiceClass.getMethod("getOperationStatus", OperationHandle.class); OperationState operationState = (OperationState) m.invoke(getCliService(), operationHandle); return new QueryStatus(QueryStatus.OpStatus.valueOf(operationState.toString()), operationHandle.hasResultSet()); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw Throwables.propagate(e); } }
@Override protected QueryStatus doFetchStatus(OperationHandle operationHandle) throws HiveSQLException, ExploreException, HandleNotFoundException { try { // In Hive 12, CLIService.getOperationStatus returns OperationState. // In Hive 13, CLIService.getOperationStatus returns OperationStatus. // Since we use Hive 13 for dev, we need the following workaround to get Hive 12 working. Class<? extends CLIService> cliServiceClass = getCliService().getClass(); Method m = cliServiceClass.getMethod("getOperationStatus", OperationHandle.class); OperationState operationState = (OperationState) m.invoke(getCliService(), operationHandle); return new QueryStatus(QueryStatus.OpStatus.valueOf(operationState.toString()), operationHandle.hasResultSet()); } catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException e) { throw Throwables.propagate(e); } }
@Override protected QueryStatus doFetchStatus(OperationHandle operationHandle) throws HiveSQLException, ExploreException, HandleNotFoundException { OperationStatus operationStatus; CLIService cliService = getCliService(); // Call the getOperationStatus method based on the number of arguments it expects. try { if (getOperationStatus.getParameterTypes().length == 2) { operationStatus = (OperationStatus) getOperationStatus.invoke(cliService, operationHandle, true); } else { operationStatus = (OperationStatus) getOperationStatus.invoke(cliService, operationHandle); } } catch (IndexOutOfBoundsException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Failed to get the status of the operation.", e); } @SuppressWarnings("ThrowableResultOfMethodCallIgnored") HiveSQLException hiveExn = operationStatus.getOperationException(); if (hiveExn != null) { return new QueryStatus(hiveExn.getMessage(), hiveExn.getSQLState()); } return new QueryStatus(QueryStatus.OpStatus.valueOf(operationStatus.getState().toString()), operationHandle.hasResultSet()); }
@Override protected QueryStatus doFetchStatus(OperationHandle operationHandle) throws HiveSQLException, ExploreException, HandleNotFoundException { OperationStatus operationStatus; CLIService cliService = getCliService(); // Call the getOperationStatus method based on the number of arguments it expects. try { if (getOperationStatus.getParameterTypes().length == 2) { operationStatus = (OperationStatus) getOperationStatus.invoke(cliService, operationHandle, true); } else { operationStatus = (OperationStatus) getOperationStatus.invoke(cliService, operationHandle); } } catch (IndexOutOfBoundsException | IllegalAccessException | InvocationTargetException e) { throw new RuntimeException("Failed to get the status of the operation.", e); } @SuppressWarnings("ThrowableResultOfMethodCallIgnored") HiveSQLException hiveExn = operationStatus.getOperationException(); if (hiveExn != null) { return new QueryStatus(hiveExn.getMessage(), hiveExn.getSQLState()); } return new QueryStatus(QueryStatus.OpStatus.valueOf(operationStatus.getState().toString()), operationHandle.hasResultSet()); }
@Override protected QueryStatus doFetchStatus(OperationHandle handle) throws HiveSQLException, ExploreException, HandleNotFoundException { OperationStatus operationStatus = getCliService().getOperationStatus(handle); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") HiveSQLException hiveExn = operationStatus.getOperationException(); if (hiveExn != null) { return new QueryStatus(hiveExn.getMessage(), hiveExn.getSQLState()); } return new QueryStatus(QueryStatus.OpStatus.valueOf(operationStatus.getState().toString()), handle.hasResultSet()); }
@Override protected QueryStatus doFetchStatus(OperationHandle handle) throws HiveSQLException, ExploreException, HandleNotFoundException { OperationStatus operationStatus = getCliService().getOperationStatus(handle); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") HiveSQLException hiveExn = operationStatus.getOperationException(); if (hiveExn != null) { return new QueryStatus(hiveExn.getMessage(), hiveExn.getSQLState()); } return new QueryStatus(QueryStatus.OpStatus.valueOf(operationStatus.getState().toString()), handle.hasResultSet()); }
@Override protected QueryStatus doFetchStatus(OperationHandle operationHandle) throws HiveSQLException, ExploreException, HandleNotFoundException { OperationStatus operationStatus = getCliService().getOperationStatus(operationHandle); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") HiveSQLException hiveExn = operationStatus.getOperationException(); if (hiveExn != null) { return new QueryStatus(hiveExn.getMessage(), hiveExn.getSQLState()); } return new QueryStatus(QueryStatus.OpStatus.valueOf(operationStatus.getState().toString()), operationHandle.hasResultSet()); }
@Override protected QueryStatus doFetchStatus(OperationHandle operationHandle) throws HiveSQLException, ExploreException, HandleNotFoundException { OperationStatus operationStatus = getCliService().getOperationStatus(operationHandle); @SuppressWarnings("ThrowableResultOfMethodCallIgnored") HiveSQLException hiveExn = operationStatus.getOperationException(); if (hiveExn != null) { return new QueryStatus(hiveExn.getMessage(), hiveExn.getSQLState()); } return new QueryStatus(QueryStatus.OpStatus.valueOf(operationStatus.getState().toString()), operationHandle.hasResultSet()); }
protected QueryStatus fetchStatus(OperationInfo operationInfo) throws ExploreException, HandleNotFoundException, HiveSQLException { QueryStatus queryStatus; try { queryStatus = doFetchStatus(operationInfo.getOperationHandle()); if (QueryStatus.OpStatus.ERROR.equals(queryStatus.getStatus()) && queryStatus.getErrorMessage() == null) { queryStatus = new QueryStatus("Operation failed. See the log for more details.", null); } } catch (HiveSQLException e) { // if this is a sql exception, record it in the query status. // it means that query execution failed, but we can successfully retrieve the status. if (e.getSQLState() != null) { queryStatus = new QueryStatus(e.getMessage(), e.getSQLState()); } else { // this is an internal error - we are not able to retrieve the status throw new ExploreException(e.getMessage(), e); } } operationInfo.setStatus(queryStatus); return queryStatus; }
protected QueryStatus fetchStatus(OperationInfo operationInfo) throws ExploreException, HandleNotFoundException, HiveSQLException { QueryStatus queryStatus; try { queryStatus = doFetchStatus(operationInfo.getOperationHandle()); if (QueryStatus.OpStatus.ERROR.equals(queryStatus.getStatus()) && queryStatus.getErrorMessage() == null) { queryStatus = new QueryStatus("Operation failed. See the log for more details.", null); } } catch (HiveSQLException e) { // if this is a sql exception, record it in the query status. // it means that query execution failed, but we can successfully retrieve the status. if (e.getSQLState() != null) { queryStatus = new QueryStatus(e.getMessage(), e.getSQLState()); } else { // this is an internal error - we are not able to retrieve the status throw new ExploreException(e.getMessage(), e); } } operationInfo.setStatus(queryStatus); return queryStatus; }