public abstract class Operation extends Object
Modifier and Type | Field and Description |
---|---|
protected Future<?> |
backgroundHandle |
protected Map<String,String> |
confOverlay |
static FetchOrientation |
DEFAULT_FETCH_ORIENTATION |
protected static EnumSet<FetchOrientation> |
DEFAULT_FETCH_ORIENTATION_SET |
protected boolean |
hasResultSet |
protected boolean |
isOperationLogEnabled |
static org.slf4j.Logger |
LOG |
protected long |
operationComplete |
protected HiveSQLException |
operationException |
protected OperationLog |
operationLog |
protected long |
operationStart |
protected HiveSession |
parentSession |
static String |
QUERYID_LOG_KEY |
protected QueryState |
queryState |
protected static Set<OperationState> |
scopeStates |
static String |
SESSIONID_LOG_KEY |
protected static Set<OperationState> |
terminalStates |
Modifier | Constructor and Description |
---|---|
protected |
Operation(HiveSession parentSession,
Map<String,String> confOverlay,
OperationType opType) |
protected |
Operation(HiveSession parentSession,
Map<String,String> confOverlay,
OperationType opType,
boolean isAsyncQueryState) |
protected |
Operation(HiveSession parentSession,
OperationType opType) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterRun()
Invoked after runInternal(), even if an exception is thrown in runInternal().
|
protected void |
assertState(List<OperationState> states) |
protected void |
beforeRun()
Invoked before runInternal().
|
abstract void |
cancel(OperationState stateAfterCancel) |
protected void |
cleanupOperationLog() |
abstract void |
close() |
protected void |
createOperationLog() |
Future<?> |
getBackgroundHandle() |
long |
getBeginTime() |
OperationHandle |
getHandle() |
long |
getLastAccessTime() |
abstract RowSet |
getNextRowSet(FetchOrientation orientation,
long maxRows) |
long |
getOperationComplete() |
OperationLog |
getOperationLog() |
long |
getOperationStart() |
long |
getOperationTimeout() |
HiveSession |
getParentSession() |
TProtocolVersion |
getProtocolVersion() |
abstract TableSchema |
getResultSetSchema() |
protected OperationState |
getState() |
OperationStatus |
getStatus() |
String |
getTaskStatus() |
OperationType |
getType() |
boolean |
hasResultSet() |
boolean |
isDone() |
boolean |
isTimedOut(long current) |
protected void |
markOperationCompletedTime() |
protected void |
markOperationStartTime() |
protected void |
onNewState(OperationState state,
OperationState prevState) |
protected void |
registerLoggingContext()
Register logging context so that Log4J can print QueryId and/or SessionId for each message
|
void |
run() |
protected abstract void |
runInternal()
Implemented by subclass of Operation class to execute specific behaviors.
|
protected void |
setBackgroundHandle(Future<?> backgroundHandle) |
protected void |
setHasResultSet(boolean hasResultSet) |
protected void |
setOperationException(HiveSQLException operationException) |
void |
setOperationTimeout(long operationTimeout) |
protected OperationState |
setState(OperationState newState) |
boolean |
shouldRunAsync() |
protected HiveSQLException |
toSQLException(String prefix,
CommandProcessorResponse response) |
protected void |
unregisterLoggingContext()
Unregister logging context
|
protected void |
unregisterOperationLog() |
protected MetricsScope |
updateOperationStateMetrics(MetricsScope stateScope,
String operationPrefix,
String completedOperationPrefix,
OperationState state) |
protected void |
validateDefaultFetchOrientation(FetchOrientation orientation)
Verify if the given fetch orientation is part of the default orientation types.
|
protected void |
validateFetchOrientation(FetchOrientation orientation,
EnumSet<FetchOrientation> supportedOrientations)
Verify if the given fetch orientation is part of the supported orientation types.
|
public static final String SESSIONID_LOG_KEY
public static final String QUERYID_LOG_KEY
protected final HiveSession parentSession
public static final FetchOrientation DEFAULT_FETCH_ORIENTATION
public static final org.slf4j.Logger LOG
protected boolean hasResultSet
protected volatile HiveSQLException operationException
protected volatile Future<?> backgroundHandle
protected OperationLog operationLog
protected boolean isOperationLogEnabled
protected long operationStart
protected long operationComplete
protected final QueryState queryState
protected static final EnumSet<FetchOrientation> DEFAULT_FETCH_ORIENTATION_SET
protected static Set<OperationState> scopeStates
protected static Set<OperationState> terminalStates
protected Operation(HiveSession parentSession, OperationType opType)
protected Operation(HiveSession parentSession, Map<String,String> confOverlay, OperationType opType)
protected Operation(HiveSession parentSession, Map<String,String> confOverlay, OperationType opType, boolean isAsyncQueryState)
public Future<?> getBackgroundHandle()
protected void setBackgroundHandle(Future<?> backgroundHandle)
public boolean shouldRunAsync()
public HiveSession getParentSession()
public OperationHandle getHandle()
public TProtocolVersion getProtocolVersion()
public OperationType getType()
public OperationStatus getStatus()
public boolean hasResultSet()
protected void setHasResultSet(boolean hasResultSet)
public OperationLog getOperationLog()
protected final OperationState setState(OperationState newState) throws HiveSQLException
HiveSQLException
public boolean isTimedOut(long current)
public long getLastAccessTime()
public long getOperationTimeout()
public void setOperationTimeout(long operationTimeout)
protected void setOperationException(HiveSQLException operationException)
protected final void assertState(List<OperationState> states) throws HiveSQLException
HiveSQLException
public boolean isDone()
protected void createOperationLog()
protected void unregisterOperationLog()
protected void beforeRun()
protected void registerLoggingContext()
protected void unregisterLoggingContext()
protected void afterRun()
protected abstract void runInternal() throws HiveSQLException
HiveSQLException
public void run() throws HiveSQLException
HiveSQLException
protected void cleanupOperationLog()
public abstract void cancel(OperationState stateAfterCancel) throws HiveSQLException
HiveSQLException
public abstract void close() throws HiveSQLException
HiveSQLException
public abstract TableSchema getResultSetSchema() throws HiveSQLException
HiveSQLException
public abstract RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException
HiveSQLException
public String getTaskStatus() throws HiveSQLException
HiveSQLException
protected void validateDefaultFetchOrientation(FetchOrientation orientation) throws HiveSQLException
orientation
- HiveSQLException
protected void validateFetchOrientation(FetchOrientation orientation, EnumSet<FetchOrientation> supportedOrientations) throws HiveSQLException
orientation
- supportedOrientations
- HiveSQLException
protected HiveSQLException toSQLException(String prefix, CommandProcessorResponse response)
protected final MetricsScope updateOperationStateMetrics(MetricsScope stateScope, String operationPrefix, String completedOperationPrefix, OperationState state)
public long getBeginTime()
protected OperationState getState()
protected void onNewState(OperationState state, OperationState prevState)
public long getOperationComplete()
public long getOperationStart()
protected void markOperationStartTime()
protected void markOperationCompletedTime()
Copyright © 2021 The Apache Software Foundation. All rights reserved.