public class QueryContext extends AbstractQueryContext implements FailureContext
AbstractQueryContext.DriverEstimateRunnable
Constructor and Description |
---|
QueryContext(PreparedQueryContext prepared,
String user,
LensConf qconf,
org.apache.hadoop.conf.Configuration conf)
Creates context from PreparedQueryContext
|
QueryContext(String query,
String user,
LensConf qconf,
org.apache.hadoop.conf.Configuration conf,
Collection<LensDriver> drivers)
Creates context from query
|
Modifier and Type | Method and Description |
---|---|
static QueryContext |
createContextWithSingleDriver(String query,
String user,
LensConf qconf,
org.apache.hadoop.conf.Configuration conf,
LensDriver driver,
String lensSessionPublicId,
boolean mergeDriverConf)
Utility create method to create context with single driver.
|
boolean |
executed() |
void |
extractFailedAttempt() |
void |
extractFailedAttempt(LensDriver selectedDriver) |
boolean |
finished() |
long |
getClosedTime()
The closed time.
|
String |
getClusterUser() |
boolean |
getCompressOutput() |
String |
getDriverOpHandle()
The driver op handle.
|
LensResultSet |
getDriverResult()
Query result registered by driver
|
String |
getDriverResultPath()
The hdfsout path.
|
BackOffRetryHandler<QueryContext> |
getDriverRetryPolicy() |
DriverQueryStatus |
getDriverStatus()
The driver status.
|
long |
getEndTime()
The end time.
|
long |
getExecuteTimeoutMillis()
This is the timeout that the client may have provided while initiating query execution
This value is used for pre fetching in-memory result if applicable
Note: in case the timeout is not provided, this value will not be set.
|
int |
getFailCount() |
List<FailedAttempt> |
getFailedAttempts() |
org.apache.hadoop.fs.Path |
getHDFSResultDir() |
long |
getLastFailedTime() |
long |
getLaunchTime()
The launch time.
|
String |
getLogHandle()
Get handle of the query for logging purposes
|
long |
getMaxResultSplitRows() |
String |
getOuptutFileExtn() |
byte[] |
getQueryConfHash() |
QueryHandle |
getQueryHandle()
The query handle.
|
String |
getQueryHandleString() |
Future |
getQueryLauncher() |
String |
getQueryName()
The query name.
|
QueryOutputFormatter |
getQueryOutputFormatter()
The query output formatter.
|
String |
getResultEncoding() |
String |
getResultFooter() |
String |
getResultHeader() |
String |
getResultSetParentDir() |
String |
getResultSetPath()
The result set path.
|
BackOffRetryHandler<QueryContext> |
getRetryPolicy() |
com.google.common.collect.ImmutableSet<QueryLaunchingConstraint> |
getSelectedDriverQueryConstraints() |
BackOffRetryHandler<QueryContext> |
getServerRetryPolicy() |
QueryStatus |
getStatus()
The status.
|
long |
getSubmissionTime()
The submission time.
|
boolean |
hasTimedout() |
void |
initTransientState() |
boolean |
isDriverPersistent()
The is driver persistent.
|
boolean |
isDriverResultRegistered()
True if driver has registered the result
|
boolean |
isFinishedQueryPersisted()
The finished query persisted.
|
boolean |
isLaunching() |
boolean |
isPersistent()
The is persistent.
|
boolean |
isQueryClosedOnDriver() |
boolean |
isResultAvailableInDriver() |
boolean |
launched() |
boolean |
queued() |
void |
registerDriverResult(LensResultSet result) |
void |
registerStatusUpdateListener(QueryDriverStatusUpdateListener driverStatusUpdateListener) |
boolean |
running() |
void |
setClosedTime(long closedTime)
The closed time.
|
void |
setDriverOpHandle(String driverOpHandle)
The driver op handle.
|
void |
setDriverResultPath(String driverResultPath)
The hdfsout path.
|
void |
setDriverRetryPolicy(BackOffRetryHandler<QueryContext> driverRetryPolicy) |
void |
setDriverStatus(DriverQueryStatus.DriverQueryState state) |
void |
setDriverStatus(DriverQueryStatus.DriverQueryState state,
String message) |
void |
setEndTime(long endTime)
The end time.
|
void |
setExecuteTimeoutMillis(long executeTimeoutMillis)
This is the timeout that the client may have provided while initiating query execution
This value is used for pre fetching in-memory result if applicable
Note: in case the timeout is not provided, this value will not be set.
|
void |
setFailedAttempts(List<FailedAttempt> failedAttempts) |
void |
setFinishedQueryPersisted(boolean finishedQueryPersisted)
The finished query persisted.
|
void |
setLaunching(boolean isLaunching) |
void |
setLaunchTime(long launchTime)
The launch time.
|
void |
setQueryClosedOnDriver(boolean isQueryClosedOnDriver) |
void |
setQueryConfHash(byte[] queryConfHash) |
void |
setQueryHandle(QueryHandle queryHandle)
The query handle.
|
void |
setQueryLauncher(Future queryLauncher) |
void |
setQueryName(String queryName)
The query name.
|
void |
setQueryOutputFormatter(QueryOutputFormatter queryOutputFormatter)
The query output formatter.
|
void |
setResultSetPath(String resultSetPath)
The result set path.
|
void |
setServerRetryPolicy(BackOffRetryHandler<QueryContext> serverRetryPolicy) |
void |
setStatus(QueryStatus newStatus) |
void |
setStatusSkippingTransitionTest(QueryStatus newStatus) |
boolean |
splitResultIntoMultipleFiles()
Split result into multiple files.
|
boolean |
successful() |
LensQuery |
toLensQuery()
To lens query.
|
String |
toString() |
void |
unSetDriverPersistent()
Set whether result is persisted on driver to false.
|
void |
updateDriverStatus(BackOffRetryHandler statusUpdateRetryHandler)
Update status from selected driver
|
void |
validateTransition(QueryStatus newStatus) |
clearTransientStateAfterCompleted, clearTransientStateAfterLaunch, estimateCostForDrivers, getConf, getDatabase, getDriverConf, getDriverContext, getDriverEstimateRunnables, getDriverQuery, getDriverQueryCost, getDriverRewriteError, getDriverRewriterPlan, getFinalDriverQuery, getHiveConf, getLensConf, getLensSessionIdentifier, getPhase1RewrittenQuery, getPriority, getQueue, getSelectedDriver, getSelectedDriverConf, getSelectedDriverQuery, getSelectedDriverQueryCost, getSelectedDriverQueryPlan, getSubmittedUser, getTableWeights, getUserQuery, isDriverQueryExplicitlySet, isOlapQuery, setConf, setDriverContext, setDriverCost, setDriverQueries, setDriverQuery, setDriverRewriteError, setFinalDriverQuery, setLensSessionIdentifier, setOlapQuery, setPhase1RewrittenQuery, setPriority, setSelectedDriver, setSelectedDriverQuery, setSelectedDriverQueryCost, updateConf
public QueryContext(String query, String user, LensConf qconf, org.apache.hadoop.conf.Configuration conf, Collection<LensDriver> drivers)
query
- the queryuser
- the userqconf
- The query lensconfconf
- the confpublic QueryContext(PreparedQueryContext prepared, String user, LensConf qconf, org.apache.hadoop.conf.Configuration conf)
prepared
- the prepareduser
- the userqconf
- the qconfconf
- the confpublic static QueryContext createContextWithSingleDriver(String query, String user, LensConf qconf, org.apache.hadoop.conf.Configuration conf, LensDriver driver, String lensSessionPublicId, boolean mergeDriverConf)
query
- The user queryuser
- The submitted queryqconf
- The query lens confconf
- Query configuration object - merged with sessiondriver
- The driverlensSessionPublicId
- The session idpublic void initTransientState()
initTransientState
in class AbstractQueryContext
public String getResultSetParentDir()
public org.apache.hadoop.fs.Path getHDFSResultDir()
public LensQuery toLensQuery()
public boolean isResultAvailableInDriver()
public void unSetDriverPersistent()
public void setStatusSkippingTransitionTest(QueryStatus newStatus)
public void setStatus(QueryStatus newStatus) throws LensException
LensException
public void updateDriverStatus(BackOffRetryHandler statusUpdateRetryHandler) throws LensException
statusUpdateRetryHandler
- The exponential retry handlerLensException
- Throws exception if update from driver has failed.public String getResultHeader()
public String getResultFooter()
public String getResultEncoding()
public String getOuptutFileExtn()
public boolean getCompressOutput()
public long getMaxResultSplitRows()
public boolean splitResultIntoMultipleFiles()
public String getClusterUser()
public String getLogHandle()
AbstractQueryContext
getLogHandle
in class AbstractQueryContext
public String getQueryHandleString()
public void validateTransition(QueryStatus newStatus) throws LensException
LensException
public boolean finished()
public boolean successful()
public boolean executed()
public boolean launched()
public boolean running()
public boolean queued()
public com.google.common.collect.ImmutableSet<QueryLaunchingConstraint> getSelectedDriverQueryConstraints()
public void registerDriverResult(LensResultSet result) throws LensException
LensException
public void setDriverStatus(DriverQueryStatus.DriverQueryState state, String message)
public void setDriverStatus(DriverQueryStatus.DriverQueryState state)
public void registerStatusUpdateListener(QueryDriverStatusUpdateListener driverStatusUpdateListener)
public long getLastFailedTime()
getLastFailedTime
in interface FailureContext
public int getFailCount()
getFailCount
in interface FailureContext
public BackOffRetryHandler<QueryContext> getRetryPolicy()
public void extractFailedAttempt()
public void extractFailedAttempt(LensDriver selectedDriver)
public boolean hasTimedout()
@Generated(value="lombok") public QueryHandle getQueryHandle()
@Generated(value="lombok") public void setQueryHandle(QueryHandle queryHandle)
@Generated(value="lombok") public boolean isPersistent()
@Generated(value="lombok") public boolean isDriverPersistent()
@Generated(value="lombok") public QueryStatus getStatus()
@Generated(value="lombok") public String getResultSetPath()
@Generated(value="lombok") public void setResultSetPath(String resultSetPath)
@Generated(value="lombok") public String getDriverResultPath()
@Generated(value="lombok") public void setDriverResultPath(String driverResultPath)
@Generated(value="lombok") public long getSubmissionTime()
@Generated(value="lombok") public long getLaunchTime()
@Generated(value="lombok") public void setLaunchTime(long launchTime)
@Generated(value="lombok") public long getEndTime()
@Generated(value="lombok") public void setEndTime(long endTime)
@Generated(value="lombok") public long getClosedTime()
@Generated(value="lombok") public void setClosedTime(long closedTime)
@Generated(value="lombok") public String getDriverOpHandle()
@Generated(value="lombok") public void setDriverOpHandle(String driverOpHandle)
@Generated(value="lombok") public DriverQueryStatus getDriverStatus()
@Generated(value="lombok") public QueryOutputFormatter getQueryOutputFormatter()
@Generated(value="lombok") public void setQueryOutputFormatter(QueryOutputFormatter queryOutputFormatter)
@Generated(value="lombok") public boolean isFinishedQueryPersisted()
@Generated(value="lombok") public void setFinishedQueryPersisted(boolean finishedQueryPersisted)
@Generated(value="lombok") public boolean isQueryClosedOnDriver()
@Generated(value="lombok") public void setQueryClosedOnDriver(boolean isQueryClosedOnDriver)
@Generated(value="lombok") public String getQueryName()
@Generated(value="lombok") public void setQueryName(String queryName)
@Generated(value="lombok") public void setExecuteTimeoutMillis(long executeTimeoutMillis)
@Generated(value="lombok") public long getExecuteTimeoutMillis()
@Generated(value="lombok") public LensResultSet getDriverResult()
@Generated(value="lombok") public boolean isDriverResultRegistered()
@Generated(value="lombok") public byte[] getQueryConfHash()
@Generated(value="lombok") public void setQueryConfHash(byte[] queryConfHash)
@Generated(value="lombok") public boolean isLaunching()
@Generated(value="lombok") public void setLaunching(boolean isLaunching)
@Generated(value="lombok") public Future getQueryLauncher()
@Generated(value="lombok") public void setQueryLauncher(Future queryLauncher)
@Generated(value="lombok") public List<FailedAttempt> getFailedAttempts()
@Generated(value="lombok") public void setFailedAttempts(List<FailedAttempt> failedAttempts)
@Generated(value="lombok") public BackOffRetryHandler<QueryContext> getDriverRetryPolicy()
@Generated(value="lombok") public void setDriverRetryPolicy(BackOffRetryHandler<QueryContext> driverRetryPolicy)
@Generated(value="lombok") public BackOffRetryHandler<QueryContext> getServerRetryPolicy()
@Generated(value="lombok") public void setServerRetryPolicy(BackOffRetryHandler<QueryContext> serverRetryPolicy)
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.