public OperationStatus getOperationStatus(OperationHandle opHandle) throws HiveSQLException { return getOperation(opHandle).getStatus(); }
public RowSet getOperationNextRowSet(OperationHandle opHandle, FetchOrientation orientation, long maxRows) throws HiveSQLException { return getOperation(opHandle).getNextRowSet(orientation, maxRows); }
public TableSchema getOperationResultSetSchema(OperationHandle opHandle) throws HiveSQLException { return getOperation(opHandle).getResultSetSchema(); }
@Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException { RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().fetchResults(opHandle, orientation, maxRows, fetchType); LOG.debug(opHandle + ": fetchResults()"); return rowSet; }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().cancelOperation(opHandle); LOG.debug(opHandle + ": cancelOperation()"); }
@Override public void closeOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().closeOperation(opHandle); LOG.debug(opHandle + ": closeOperation"); }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { TableSchema tableSchema = sessionManager.getOperationManager() .getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle); LOG.debug(opHandle + ": getResultSetMetadata()"); return tableSchema; }
@Override public String getQueryId(TOperationHandle opHandle) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation( new OperationHandle(opHandle)); final String queryId = operation.getQueryId(); LOG.debug(opHandle + ": getQueryId() " + queryId); return queryId; }
/** * Cancel the running operation unless it is already in a terminal state * @param opHandle operation handle * @param errMsg error message * @throws HiveSQLException */ public void cancelOperation(OperationHandle opHandle, String errMsg) throws HiveSQLException { Operation operation = getOperation(opHandle); OperationState opState = operation.getStatus().getState(); if (opState.isTerminal()) { // Cancel should be a no-op in either cases LOG.debug(opHandle + ": Operation is already aborted in state - " + opState); } else { LOG.debug(opHandle + ": Attempting to cancel from state - " + opState); OperationState operationState = OperationState.CANCELED; operationState.setErrorMessage(errMsg); operation.cancel(operationState); if (operation instanceof SQLOperation) { removeSafeQueryInfo(opHandle); } } }
private double getProgressedPercentage(OperationHandle opHandle) throws HiveSQLException { checkArgument(OperationType.EXECUTE_STATEMENT.equals(opHandle.getOperationType())); Operation operation = cliService.getSessionManager().getOperationManager().getOperation(opHandle); SessionState state = operation.getParentSession().getSessionState(); ProgressMonitor monitor = state.getProgressMonitor(); return monitor == null ? 0.0 : monitor.progressedPercentage(); }
@Override public OperationStatus getOperationStatus(OperationHandle opHandle, boolean getProgressUpdate) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation(opHandle);
public RowSet getOperationLogRowSet(OperationHandle opHandle, FetchOrientation orientation, long maxRows, HiveConf hConf) throws HiveSQLException { TableSchema tableSchema = new TableSchema(getLogSchema()); RowSet rowSet = RowSetFactory.create(tableSchema, getOperation(opHandle).getProtocolVersion(), false); if (hConf.getBoolVar(ConfVars.HIVE_SERVER2_LOGGING_OPERATION_ENABLED) == false) { LOG.warn("Try to get operation log when hive.server2.logging.operation.enabled is false, no log will be returned. "); return rowSet; } // get the OperationLog object from the operation OperationLog operationLog = getOperation(opHandle).getOperationLog(); if (operationLog == null) { throw new HiveSQLException("Couldn't find log associated with operation handle: " + opHandle); } // read logs List<String> logs; try { logs = operationLog.readOperationLog(isFetchFirst(orientation), maxRows); } catch (SQLException e) { throw new HiveSQLException(e.getMessage(), e.getCause()); } // convert logs to RowSet for (String log : logs) { rowSet.addRow(new String[] { log }); } return rowSet; }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { TableSchema tableSchema = sessionManager.getOperationManager() .getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle); LOG.debug(opHandle + ": getResultSetMetadata()"); return tableSchema; }
@Override public void cancelOperation(OperationHandle opHandle) throws HiveSQLException { sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().cancelOperation(opHandle); LOG.debug(opHandle + ": cancelOperation()"); }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { TableSchema tableSchema = sessionManager.getOperationManager() .getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle); LOG.debug(opHandle + ": getResultSetMetadata()"); return tableSchema; }
@Override public TableSchema getResultSetMetadata(OperationHandle opHandle) throws HiveSQLException { TableSchema tableSchema = sessionManager.getOperationManager() .getOperation(opHandle).getParentSession().getResultSetMetadata(opHandle); LOG.debug(opHandle + ": getResultSetMetadata()"); return tableSchema; }
@Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException { RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().fetchResults(opHandle, orientation, maxRows, fetchType); LOG.debug(opHandle + ": fetchResults()"); return rowSet; }
@Override public RowSet fetchResults(OperationHandle opHandle, FetchOrientation orientation, long maxRows, FetchType fetchType) throws HiveSQLException { RowSet rowSet = sessionManager.getOperationManager().getOperation(opHandle) .getParentSession().fetchResults(opHandle, orientation, maxRows, fetchType); LOG.debug(opHandle + ": fetchResults()"); return rowSet; }
@Override public String getQueryId(TOperationHandle opHandle) throws HiveSQLException { Operation operation = sessionManager.getOperationManager().getOperation( new OperationHandle(opHandle)); final String queryId = operation.getParentSession().getHiveConf().getVar(ConfVars.HIVEQUERYID); LOG.debug(opHandle + ": getQueryId() " + queryId); return queryId; }
private double getProgressedPercentage(OperationHandle opHandle) throws HiveSQLException { checkArgument(OperationType.EXECUTE_STATEMENT.equals(opHandle.getOperationType())); Operation operation = cliService.getSessionManager().getOperationManager().getOperation(opHandle); SessionState state = operation.getParentSession().getSessionState(); ProgressMonitor monitor = state.getProgressMonitor(); return monitor == null ? 0.0 : monitor.progressedPercentage(); }