public abstract class Operation extends Object
Modifier and Type | Field and Description |
---|---|
protected Future<?> |
backgroundHandle |
static long |
DEFAULT_FETCH_MAX_ROWS |
static FetchOrientation |
DEFAULT_FETCH_ORIENTATION |
protected static EnumSet<FetchOrientation> |
DEFAULT_FETCH_ORIENTATION_SET |
protected boolean |
hasResultSet |
protected boolean |
isOperationLogEnabled |
static org.apache.commons.logging.Log |
LOG |
protected HiveSQLException |
operationException |
protected OperationLog |
operationLog |
protected HiveSession |
parentSession |
protected boolean |
runAsync |
Modifier | Constructor and Description |
---|---|
protected |
Operation(HiveSession parentSession,
OperationType opType,
boolean runInBackground) |
Modifier and Type | Method and Description |
---|---|
protected void |
afterRun()
Invoked after runInternal(), even if an exception is thrown in runInternal().
|
protected void |
assertState(OperationState state) |
protected void |
beforeRun()
Invoked before runInternal().
|
void |
cancel() |
protected void |
cleanupOperationLog() |
abstract void |
close() |
protected void |
createOperationLog() |
Future<?> |
getBackgroundHandle() |
HiveConf |
getConfiguration() |
OperationHandle |
getHandle() |
long |
getLastAccessTime() |
RowSet |
getNextRowSet() |
abstract RowSet |
getNextRowSet(FetchOrientation orientation,
long maxRows) |
OperationLog |
getOperationLog() |
long |
getOperationTimeout() |
HiveSession |
getParentSession() |
TProtocolVersion |
getProtocolVersion() |
abstract TableSchema |
getResultSetSchema() |
OperationStatus |
getStatus() |
OperationType |
getType() |
boolean |
hasResultSet() |
boolean |
isCanceled() |
boolean |
isFailed() |
boolean |
isFinished() |
boolean |
isRunning() |
boolean |
isTimedOut(long current) |
void |
run() |
protected abstract void |
runInternal()
Implemented by subclass of Operation class to execute specific behaviors.
|
protected void |
setBackgroundHandle(Future<?> backgroundHandle) |
void |
setConfiguration(HiveConf configuration) |
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 |
unregisterOperationLog() |
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.
|
protected final HiveSession parentSession
public static final org.apache.commons.logging.Log LOG
public static final FetchOrientation DEFAULT_FETCH_ORIENTATION
public static final long DEFAULT_FETCH_MAX_ROWS
protected boolean hasResultSet
protected volatile HiveSQLException operationException
protected final boolean runAsync
protected volatile Future<?> backgroundHandle
protected OperationLog operationLog
protected boolean isOperationLogEnabled
protected static final EnumSet<FetchOrientation> DEFAULT_FETCH_ORIENTATION_SET
protected Operation(HiveSession parentSession, OperationType opType, boolean runInBackground)
public Future<?> getBackgroundHandle()
protected void setBackgroundHandle(Future<?> backgroundHandle)
public boolean shouldRunAsync()
public void setConfiguration(HiveConf configuration)
public HiveConf getConfiguration()
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(OperationState state) throws HiveSQLException
HiveSQLException
public boolean isRunning()
public boolean isFinished()
public boolean isCanceled()
public boolean isFailed()
protected void createOperationLog()
protected void unregisterOperationLog()
protected void beforeRun()
protected void afterRun()
protected abstract void runInternal() throws HiveSQLException
HiveSQLException
public void run() throws HiveSQLException
HiveSQLException
protected void cleanupOperationLog()
public void cancel() 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 RowSet getNextRowSet() 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)
Copyright © 2017 The Apache Software Foundation. All rights reserved.