public class QueryExecutionServiceImpl extends BaseLensService implements QueryExecutionService
| Modifier and Type | Class and Description |
|---|---|
class |
QueryExecutionServiceImpl.FinishedQuery
The Class FinishedQuery.
|
static class |
QueryExecutionServiceImpl.QueryCount |
static class |
QueryExecutionServiceImpl.QueryStatusLogger
The Class QueryStatusLogger.
|
class |
QueryExecutionServiceImpl.RewriteEstimateRunnable
Chains driver specific rewrite and estimate of the query in a single runnable, which can be processed in a
background thread
|
BaseLensService.SessionContext| Modifier and Type | Field and Description |
|---|---|
static String |
NAME
The Constant NAME.
|
static String |
PREPARED_QUERIES_COUNTER
The Constant PREPARED_QUERIES_COUNTER.
|
static String |
PREPARED_QUERY_PURGER_COUNTER
The Constant PREPARED_QUERY_PURGER_COUNTER.
|
static String |
QUERY_EXPIRY_FAILURE_COUNTER |
static String |
QUERY_PURGER_COUNTER
The Constant QUERY_PURGER_COUNTER.
|
static String |
QUERY_SUBMITTER_COUNTER
The Constant QUERY_SUBMITTER_COUNTER.
|
static String |
STATUS_UPDATE_COUNTER
The Constant STATUS_UPDATE_COUNTER.
|
static String |
TOTAL_QUERIES_EXPIRED |
| Constructor and Description |
|---|
QueryExecutionServiceImpl(org.apache.hive.service.cli.CLIService cliService)
Instantiates a new query execution service impl.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
cancelQuery(LensSessionHandle sessionHandle,
QueryHandle queryHandle)
Cancel the execution of the query, specified by the handle.
|
void |
closeDriverSessions(LensSessionHandle sessionHandle)
Allow drivers to release resources acquired for a session if any.
|
void |
closeResultSet(LensSessionHandle sessionHandle,
QueryHandle queryHandle)
Closes result set by releasing any resources used in serving the resultset.
|
void |
deleteResource(LensSessionHandle sessionHandle,
String type,
String path) |
boolean |
destroyPrepared(LensSessionHandle sessionHandle,
QueryPrepareHandle prepared)
Destroy a prepared query.
|
QueryCost |
estimate(String requestId,
LensSessionHandle sessionHandle,
String query,
LensConf lensConf)
Estimate the cost of given query.
|
QueryHandleWithResultSet |
execute(LensSessionHandle sessionHandle,
String query,
long timeoutMillis,
LensConf conf,
String queryName)
Execute the query with a timeout.
|
QueryHandle |
executeAsync(LensSessionHandle sessionHandle,
String query,
LensConf conf,
String queryName)
Asynchronously execute the query.
|
QueryHandleWithResultSet |
executePrepare(LensSessionHandle sessionHandle,
QueryPrepareHandle prepareHandle,
long timeoutMillis,
LensConf conf,
String queryName)
Execute already prepared query with timeout.
|
QueryHandle |
executePrepareAsync(LensSessionHandle sessionHandle,
QueryPrepareHandle prepareHandle,
LensConf conf,
String queryName)
Execute already prepared query asynchronously.
|
QueryPlan |
explain(String requestId,
LensSessionHandle sessionHandle,
String query,
LensConf lensConf)
Explain the given query.
|
QueryPlan |
explainAndPrepare(LensSessionHandle sessionHandle,
String query,
LensConf lensConf,
String queryName)
Explain the given query and prepare it as well.
|
QueryResult |
fetchResultSet(LensSessionHandle sessionHandle,
QueryHandle queryHandle,
long startIndex,
int fetchSize)
Fetch the results of the query, specified by the handle.
|
List<QueryPrepareHandle> |
getAllPreparedQueries(LensSessionHandle sessionHandle,
String user,
String queryName,
String fromDate,
String toDate)
Returns all the prepared queries for the specified user.
|
List<QueryHandle> |
getAllQueries(LensSessionHandle sessionHandle,
String states,
String userName,
String driver,
String queryName,
String fromDate,
String toDate)
Returns all the queries in the specified state, for the given user and matching query name.
|
List<LensQuery> |
getAllQueryDetails(LensSessionHandle sessionHandle,
String states,
String userName,
String driver,
String queryName,
String fromDate,
String toDate)
Returns all the queries in the specified state, for the given user and matching query name.
|
long |
getFinishedQueriesCount()
Get finished queries count
|
HealthStatus |
getHealthStatus()
Returns the health status of the service.
|
javax.ws.rs.core.Response |
getHttpResultSet(LensSessionHandle sessionHandle,
QueryHandle queryHandle)
Get the http end point for the result set.
|
long |
getInMemoryResultsetTTLMillis()
This is the TTL millis for all result sets of type
InMemoryResultSet
Note : this field is non final and has a Getter and Setter for test cases |
EstimatedQueryCollection |
getLaunchedQueries()
The launched queries.
|
long |
getLaunchingQueriesCount()
Get queries being launched count
|
LensPreparedQuery |
getPreparedQuery(LensSessionHandle sessionHandle,
QueryPrepareHandle prepareHandle)
Get prepared query.
|
LensQuery |
getQuery(LensSessionHandle sessionHandle,
QueryHandle queryHandle)
Get the query, specified by the handle.
|
QueryContext |
getQueryContext(QueryHandle queryHandle)
Gets the query context.
|
QueryExecutionServiceImpl.QueryCount |
getQueryCountSnapshot() |
long |
getQueuedQueriesCount()
Get queued queries count
|
QueryResultSetMetadata |
getResultSetMetadata(LensSessionHandle sessionHandle,
QueryHandle queryHandle)
Get the result set metadata - list of columns(names and types) and result size.
|
long |
getRunningQueriesCount()
Get running queries count
|
long |
getWaitingQueriesCount()
Get waiting queries count
|
void |
init(org.apache.hadoop.hive.conf.HiveConf hiveConf) |
void |
pauseQuerySubmitter(boolean pause)
Pause query submitter.
|
QueryPrepareHandle |
prepare(LensSessionHandle sessionHandle,
String query,
LensConf lensConf,
String queryName)
Prepare the query.
|
void |
prepareStopping()
Prepare stopping.
|
void |
readExternal(ObjectInput in) |
void |
setInMemoryResultsetTTLMillis(long inMemoryResultsetTTLMillis)
This is the TTL millis for all result sets of type
InMemoryResultSet
Note : this field is non final and has a Getter and Setter for test cases |
void |
start() |
void |
stop() |
boolean |
updateQueryConf(LensSessionHandle sessionHandle,
QueryHandle queryHandle,
LensConf newconf)
Update the query conf.
|
boolean |
updateQueryConf(LensSessionHandle sessionHandle,
QueryPrepareHandle prepareHandle,
LensConf newconf)
Update configuration for prepared query.
|
void |
writeExternal(ObjectOutput out) |
acquire, acquire, closeSession, getCliService, getHiveSessionHandle, getLensConf, getLensConf, getNumberOfSessions, getServerDomain, getSession, getSessionInfo, getSessionManager, getValidPath, openSession, openSession, release, release, removePrefixBeforeURI, restoreSession, validateSessiongetHiveConf, getName, getServiceState, getStartTime, register, unregisterequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitvalidateSessionpublic static final String PREPARED_QUERIES_COUNTER
public static final String QUERY_SUBMITTER_COUNTER
public static final String STATUS_UPDATE_COUNTER
public static final String QUERY_PURGER_COUNTER
public static final String QUERY_EXPIRY_FAILURE_COUNTER
public static final String TOTAL_QUERIES_EXPIRED
public static final String PREPARED_QUERY_PURGER_COUNTER
public static final String NAME
public QueryExecutionServiceImpl(org.apache.hive.service.cli.CLIService cliService)
throws LensException
cliService - the cli serviceLensException - the lens exceptionpublic void pauseQuerySubmitter(boolean pause)
public void init(org.apache.hadoop.hive.conf.HiveConf hiveConf)
init in interface org.apache.hive.service.Serviceinit in class org.apache.hive.service.CompositeServicepublic void prepareStopping()
BaseLensServiceprepareStopping in class BaseLensServicepublic void stop()
stop in interface org.apache.hive.service.Servicestop in class org.apache.hive.service.CompositeServicepublic void start()
start in interface org.apache.hive.service.Servicestart in class org.apache.hive.service.CompositeServicepublic QueryPrepareHandle prepare(LensSessionHandle sessionHandle, String query, LensConf lensConf, String queryName) throws LensException
QueryExecutionServiceprepare in interface QueryExecutionServicesessionHandle - the session handlequery - The query should be in HiveQL(SQL like)lensConf - The query configurationqueryName - the query nameLensException - the lens exceptionpublic QueryPlan explainAndPrepare(LensSessionHandle sessionHandle, String query, LensConf lensConf, String queryName) throws LensException
QueryExecutionServiceexplainAndPrepare in interface QueryExecutionServicesessionHandle - the session handlequery - The query should be in HiveQL(SQL like)lensConf - The query configurationqueryName - the query nameLensException - the lens exceptionpublic QueryHandle executePrepareAsync(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, LensConf conf, String queryName) throws LensException
QueryExecutionServiceexecutePrepareAsync in interface QueryExecutionServicesessionHandle - the session handleprepareHandle - The QueryPrepareHandleconf - The configuration for the query to executequeryName - the query nameLensException - the lens exceptionpublic QueryHandleWithResultSet executePrepare(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, long timeoutMillis, LensConf conf, String queryName) throws LensException
QueryExecutionServiceexecutePrepare in interface QueryExecutionServicesessionHandle - the session handleprepareHandle - The QueryPrepareHandletimeoutMillis - The timeout after which it will return handle, if query did not finish before.conf - The configuration for the query to executequeryName - the query nameLensException - the lens exceptionpublic QueryHandle executeAsync(LensSessionHandle sessionHandle, String query, LensConf conf, String queryName) throws LensException
QueryExecutionServiceexecuteAsync in interface QueryExecutionServicesessionHandle - the session handlequery - The query should be in HiveQL(SQL like)conf - The query configurationqueryName - the query nameLensException - the lens exceptionpublic boolean updateQueryConf(LensSessionHandle sessionHandle, QueryHandle queryHandle, LensConf newconf) throws LensException
QueryExecutionServiceupdateQueryConf in interface QueryExecutionServicesessionHandle - the session handlequeryHandle - the query handlenewconf - the newconfLensException - the lens exceptionpublic boolean updateQueryConf(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, LensConf newconf) throws LensException
QueryExecutionServiceupdateQueryConf in interface QueryExecutionServicesessionHandle - the session handleprepareHandle - the prepare handlenewconf - the newconfLensException - the lens exceptionpublic QueryContext getQueryContext(QueryHandle queryHandle)
queryHandle - the query handlepublic LensQuery getQuery(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException
QueryExecutionServicegetQuery in interface QueryExecutionServicesessionHandle - the session handlequeryHandle - The query handleLensException - the lens exceptionpublic LensPreparedQuery getPreparedQuery(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle) throws LensException
QueryExecutionServicegetPreparedQuery in interface QueryExecutionServicesessionHandle - the session handleprepareHandle - the prepare handleLensException - the lens exceptionpublic QueryHandleWithResultSet execute(LensSessionHandle sessionHandle, String query, long timeoutMillis, LensConf conf, String queryName) throws LensException
QueryExecutionServiceexecute in interface QueryExecutionServicesessionHandle - the session handlequery - The query should be in HiveQL(SQL like)timeoutMillis - The timeout after which it will return handle, if query did not finish before.conf - The query configurationqueryName - the query nameLensException - the lens exceptionpublic QueryResultSetMetadata getResultSetMetadata(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException
QueryExecutionServicegetResultSetMetadata in interface QueryExecutionServicesessionHandle - the session handlequeryHandle - the query handleLensException - the lens exceptionpublic QueryResult fetchResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle, long startIndex, int fetchSize) throws LensException
QueryExecutionServicefetchResultSet in interface QueryExecutionServicesessionHandle - the session handlequeryHandle - The query handlestartIndex - The start Index from which result rows have to be fetchedfetchSize - Number of rows to be fetchedLensException - the lens exceptionpublic void closeResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException
QueryExecutionServicecloseResultSet in interface QueryExecutionServicesessionHandle - the session handlequeryHandle - the query handleLensException - the lens exceptionpublic boolean cancelQuery(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException
QueryExecutionServicecancelQuery in interface QueryExecutionServicesessionHandle - the session handlequeryHandle - The query handle.LensException - the lens exceptionpublic List<LensQuery> getAllQueryDetails(LensSessionHandle sessionHandle, String states, String userName, String driver, String queryName, String fromDate, String toDate) throws LensException
QueryExecutionServicegetAllQueryDetails in interface QueryExecutionServicesessionHandle - the session handlestates - return queries in these state. if null, all queries will be returned. Multiple states can
be supplied separated by commauserName - Get queries submitted by a specific user.
If this set to "all", queries of all users are returneddriver - Get queries submitted on a specific driver.queryName - return queries containing the query name. If null, all queries will be returnedfromDate - start date of time range intervaltoDate - end date of the time range intervalLensException - the lens exceptionpublic List<QueryHandle> getAllQueries(LensSessionHandle sessionHandle, String states, String userName, String driver, String queryName, String fromDate, String toDate) throws LensException
QueryExecutionServicegetAllQueries in interface QueryExecutionServicesessionHandle - the session handlestates - return queries in these state. if null, all queries will be returned. Multiple states can
be supplied separated by commauserName - Get queries submitted by a specific user.
If this set to "all", queries of all users are returneddriver - Get queries submitted on a specific driver.queryName - return queries containing the query name. If null, all queries will be returnedfromDate - start date of time range intervaltoDate - end date of the time range intervalLensException - the lens exceptionpublic List<QueryPrepareHandle> getAllPreparedQueries(LensSessionHandle sessionHandle, String user, String queryName, String fromDate, String toDate) throws LensException
QueryExecutionServicegetAllPreparedQueries in interface QueryExecutionServicesessionHandle - the session handleuser - returns queries of the user. If set to "all", returns queries of all users.
By default returns the queries
of the current user.queryName - returns queries matching the query namefromDate - start time for filtering prepared queries by preparation timetoDate - end time for filtering prepared queries by preparation timeLensException - the lens exceptionpublic boolean destroyPrepared(LensSessionHandle sessionHandle, QueryPrepareHandle prepared) throws LensException
QueryExecutionServicedestroyPrepared in interface QueryExecutionServicesessionHandle - the session handleprepared - the preparedLensException - the lens exceptionpublic QueryCost estimate(String requestId, LensSessionHandle sessionHandle, String query, LensConf lensConf) throws LensException
QueryExecutionServiceestimate in interface QueryExecutionServicerequestId - the request Id of request used to start estimate operationsessionHandle - the session handlequery - The query should be in HiveQL(SQL like)lensConf - The query configurationLensException - thrown in case of failurepublic QueryPlan explain(String requestId, LensSessionHandle sessionHandle, String query, LensConf lensConf) throws LensException
QueryExecutionServiceexplain in interface QueryExecutionServicerequestId - the request Id of request used to start explain operationsessionHandle - the session handlequery - The query should be in HiveQL(SQL like)lensConf - The query configurationLensException - the lens exceptionpublic void deleteResource(LensSessionHandle sessionHandle, String type, String path) throws LensException
LensExceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
readExternal in interface ExternalizablereadExternal in class BaseLensServiceIOExceptionClassNotFoundExceptionpublic void writeExternal(ObjectOutput out) throws IOException
writeExternal in interface ExternalizablewriteExternal in class BaseLensServiceIOExceptionpublic HealthStatus getHealthStatus()
getHealthStatus in interface HealthCheckablepublic javax.ws.rs.core.Response getHttpResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle) throws LensException
QueryExecutionServicegetHttpResultSet in interface QueryExecutionServicesessionHandle - The lens session handlequeryHandle - The query handleLensException - the lens exceptionpublic void closeDriverSessions(LensSessionHandle sessionHandle)
sessionHandle - the session handlepublic long getQueuedQueriesCount()
QueryExecutionServicegetQueuedQueriesCount in interface QueryExecutionServicepublic long getRunningQueriesCount()
QueryExecutionServicegetRunningQueriesCount in interface QueryExecutionServicepublic long getWaitingQueriesCount()
QueryExecutionServicegetWaitingQueriesCount in interface QueryExecutionServicepublic long getFinishedQueriesCount()
QueryExecutionServicegetFinishedQueriesCount in interface QueryExecutionServicepublic long getLaunchingQueriesCount()
QueryExecutionServicegetLaunchingQueriesCount in interface QueryExecutionServicepublic QueryExecutionServiceImpl.QueryCount getQueryCountSnapshot()
@Generated(value="lombok") public EstimatedQueryCollection getLaunchedQueries()
@Generated(value="lombok") public long getInMemoryResultsetTTLMillis()
InMemoryResultSet
Note : this field is non final and has a Getter and Setter for test cases@Generated(value="lombok") public void setInMemoryResultsetTTLMillis(long inMemoryResultsetTTLMillis)
InMemoryResultSet
Note : this field is non final and has a Getter and Setter for test casesCopyright © 2014–2018 Apache Software Foundation. All rights reserved.