public class QueryServiceResource extends Object
Constructor and Description |
---|
QueryServiceResource()
Instantiates a new query service resource.
|
Modifier and Type | Method and Description |
---|---|
APIResult |
cancelAllQueries(LensSessionHandle sessionid,
String state,
String user,
String queryName,
long fromDate,
long toDate)
Cancel all the queries in query server; can be filtered with state and user.
|
APIResult |
cancelQuery(LensSessionHandle sessionid,
String queryHandle)
Cancel the query specified by the handle.
|
APIResult |
closeResultSet(LensSessionHandle sessionid,
String queryHandle)
Close the result set once fetching is done.
|
APIResult |
destroyPrepared(LensSessionHandle sessionid,
String prepareHandle)
Destroy the prepared query specified by handle.
|
APIResult |
destroyPreparedQueries(LensSessionHandle sessionid,
String user,
String queryName,
long fromDate,
long toDate)
Destroy all the prepared queries; Can be filtered with user.
|
QuerySubmitResult |
executePrepared(LensSessionHandle sessionid,
String prepareHandle,
String operation,
LensConf conf,
Long timeoutmillis,
String queryName)
Submit prepared query for execution.
|
List<QueryPrepareHandle> |
getAllPreparedQueries(LensSessionHandle sessionid,
String user,
String queryName,
long fromDate,
long toDate)
Get all prepared queries in the query server; can be filtered with user.
|
List<QueryHandle> |
getAllQueries(LensSessionHandle sessionid,
String state,
String queryName,
String user,
long fromDate,
long toDate)
Get all the queries in the query server; can be filtered with state and queryName.
|
javax.ws.rs.core.Response |
getHttpResultSet(LensSessionHandle sessionid,
String queryHandle)
Get the http endpoint for result set.
|
String |
getMessage()
API to know if Query service is up and running
|
LensPreparedQuery |
getPreparedQuery(LensSessionHandle sessionid,
String prepareHandle)
Get a prepared query specified by handle.
|
QueryResult |
getResultSet(LensSessionHandle sessionid,
String queryHandle,
long startIndex,
int fetchSize)
Fetch the result set.
|
QueryResultSetMetadata |
getResultSetMetadata(LensSessionHandle sessionid,
String queryHandle)
Get resultset metadata of the query.
|
LensQuery |
getStatus(LensSessionHandle sessionid,
String queryHandle)
Get lens query and its current status.
|
LensAPIResult<? extends QuerySubmitResult> |
prepareQuery(LensSessionHandle sessionid,
String query,
String operation,
LensConf conf,
String queryName)
Prepare a query or 'explain and prepare' the query.
|
LensAPIResult<? extends QuerySubmitResult> |
query(LensSessionHandle sessionid,
String query,
String operation,
LensConf conf,
Long timeoutmillis,
String queryName)
Submit the query for explain or execute or execute with a timeout.
|
APIResult |
updateConf(LensSessionHandle sessionid,
String queryHandle,
LensConf conf)
Modify query configuration if it is not running yet.
|
APIResult |
updatePreparedConf(LensSessionHandle sessionid,
String prepareHandle,
LensConf conf)
Modify prepared query's configuration.
|
public QueryServiceResource() throws LensException
LensException
- the lens exceptionpublic String getMessage()
public List<QueryHandle> getAllQueries(LensSessionHandle sessionid, String state, String queryName, String user, long fromDate, long toDate)
sessionid
- The sessionid in which queryName is workingstate
- If any state is passed, all the queries in that state will be returned, otherwise all queries will
be returned. Possible states are {link QueryStatus.Status#values()}queryName
- If any queryName is passed, all the queries containing the queryName will be returned, otherwise
all the queries will be returneduser
- Returns queries submitted by this user. If set to "all", returns queries of all users. By default,
returns queries of the current user.fromDate
- from date to search queries in a time range, the range is inclusive(submitTime >= fromDate)toDate
- to date to search queries in a time range, the range is inclusive(toDate >= submitTime)QueryHandle
objectspublic LensAPIResult<? extends QuerySubmitResult> query(LensSessionHandle sessionid, String query, String operation, LensConf conf, Long timeoutmillis, String queryName) throws LensException
sessionid
- The session in which user is submitting the query. Any configuration set in the session will
be picked up.query
- The query to runoperation
- The operation on the query. Supported operations are values:
SubmitOp.ESTIMATE
,
SubmitOp.EXPLAIN
,
SubmitOp.EXECUTE
and
SubmitOp.EXECUTE_WITH_TIMEOUT
conf
- The configuration for the querytimeoutmillis
- The timeout for the query, honored only in case of value SubmitOp.EXECUTE_WITH_TIMEOUT
operationqueryName
- human readable query name set by user (optional parameter)LensAPIResult
with DATA as QueryHandle
in case of
SubmitOp.EXECUTE
operation.
QueryPlan
in case of SubmitOp.EXPLAIN
operation.
QueryHandleWithResultSet
in case SubmitOp.EXECUTE_WITH_TIMEOUT
operation. QueryCostTO
in case of SubmitOp.ESTIMATE
operation.LensException
public APIResult cancelAllQueries(LensSessionHandle sessionid, String state, String user, String queryName, long fromDate, long toDate)
sessionid
- The session in which cancel is issuedstate
- If any state is passed, all the queries in that state will be cancelled, otherwise all queries
will be cancelled. Possible states are
QueryStatus.Status.values()
The queries in QueryStatus.Status.FAILED
,
QueryStatus.Status.CLOSED
,
QueryStatus.Status.SUCCESSFUL
cannot be cancelleduser
- If any user is passed, all the queries submitted by the user will be cancelled, otherwise all the
queries will be cancelledqueryName
- Cancel queries matching the query namefromDate
- the from date, inclusive(submitTime>=fromDate)toDate
- the to date, inclusive(toDate>=submitTime)APIResult.Status.SUCCEEDED
in case of successful
cancellation. APIResult with state APIResult.Status.FAILED
in case of cancellation failure. APIResult with state
APIResult.Status.PARTIAL
in case of partial cancellation.public List<QueryPrepareHandle> getAllPreparedQueries(LensSessionHandle sessionid, String user, String queryName, long fromDate, long toDate)
sessionid
- The sessionid in which user is workinguser
- 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 timepublic LensAPIResult<? extends QuerySubmitResult> prepareQuery(LensSessionHandle sessionid, String query, String operation, LensConf conf, String queryName) throws LensException
sessionid
- The session in which user is preparing the query. Any configuration set in the session will be
picked up.query
- The query to prepareoperation
- The operation on the query. Supported operations are
SubmitOp.EXPLAIN_AND_PREPARE
or
SubmitOp.PREPARE
conf
- The configuration for preparing the queryqueryName
- human readable query name set by user (optional parameter)QueryPrepareHandle
incase of {link org.apache.lens.api.query.SubmitOp#PREPARE} operation.
QueryPlan
incase of SubmitOp.EXPLAIN_AND_PREPARE
and the query plan will contain the prepare handle as well.LensException
public APIResult destroyPreparedQueries(LensSessionHandle sessionid, String user, String queryName, long fromDate, long toDate)
sessionid
- The session in which cancel is issueduser
- destroys queries of the user. If set to "all", destroys queries of all users. By default destroys
the queries of the current user.queryName
- destroys queries matching the query namefromDate
- the from datetoDate
- the to dateAPIResult.Status.SUCCEEDED
in case of successful
destroy. APIResult with state APIResult.Status.FAILED
in case of destroy
failure. APIResult with state APIResult.Status.PARTIAL
in case of
partial destroy.public LensPreparedQuery getPreparedQuery(LensSessionHandle sessionid, String prepareHandle)
sessionid
- The user session handleprepareHandle
- The prepare handleLensPreparedQuery
public APIResult destroyPrepared(LensSessionHandle sessionid, String prepareHandle)
sessionid
- The user session handleprepareHandle
- The prepare handleAPIResult.Status.SUCCEEDED
in case of successful
destroy. APIResult with state APIResult.Status.FAILED
in case of
destroy failure.public LensQuery getStatus(LensSessionHandle sessionid, String queryHandle)
sessionid
- The user session handlequeryHandle
- The query handleLensQuery
public APIResult cancelQuery(LensSessionHandle sessionid, String queryHandle)
sessionid
- The user session handlequeryHandle
- The query handleAPIResult.Status.SUCCEEDED
in case of successful
cancellation. APIResult with state APIResult.Status.FAILED
in case of
cancellation failure.public APIResult updateConf(LensSessionHandle sessionid, String queryHandle, LensConf conf)
sessionid
- The user session handlequeryHandle
- The query handleconf
- The new configuration, will be on top of old oneAPIResult.Status.SUCCEEDED
in case of successful
update. APIResult with state APIResult.Status.FAILED
in case of udpate failure.public APIResult updatePreparedConf(LensSessionHandle sessionid, String prepareHandle, LensConf conf)
sessionid
- The user session handleprepareHandle
- The prepare handleconf
- The new configuration, will be on top of old oneAPIResult.Status.SUCCEEDED
in case of successful
update. APIResult with state APIResult.Status.FAILED
in case of udpate failure.public QuerySubmitResult executePrepared(LensSessionHandle sessionid, String prepareHandle, String operation, LensConf conf, Long timeoutmillis, String queryName)
sessionid
- The session in which user is submitting the query. Any configuration set in the session will
be picked up.prepareHandle
- The Query to runoperation
- The operation on the query. Supported operations are
SubmitOp.EXECUTE
and SubmitOp.EXECUTE_WITH_TIMEOUT
conf
- The configuration for the execution of querytimeoutmillis
- The timeout for the query, honored only in case of
SubmitOp.EXECUTE_WITH_TIMEOUT
operationqueryName
- human readable query name set by user (optional parameter)QueryHandle
in case of {link org.apache.lens.api.query.SubmitOp#EXECUTE} operation.
QueryHandleWithResultSet
in case SubmitOp.EXECUTE_WITH_TIMEOUT
operation.public QueryResultSetMetadata getResultSetMetadata(LensSessionHandle sessionid, String queryHandle)
sessionid
- The user session handlequeryHandle
- The query handleQueryResultSetMetadata
public QueryResult getResultSet(LensSessionHandle sessionid, String queryHandle, long startIndex, int fetchSize)
sessionid
- The user session handlequeryHandle
- The query handlestartIndex
- start index of the resultfetchSize
- fetch sizeQueryResult
public javax.ws.rs.core.Response getHttpResultSet(LensSessionHandle sessionid, String queryHandle)
sessionid
- The user session handlequeryHandle
- The query handlepublic APIResult closeResultSet(LensSessionHandle sessionid, String queryHandle)
sessionid
- The user session handlequeryHandle
- The query handleAPIResult.Status.SUCCEEDED
in case of successful
close. APIResult with state APIResult.Status.FAILED
in case of close failure.Copyright © 2014–2015 Apache Software Foundation. All rights reserved.