|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.lens.server.query.QueryServiceResource
@Path(value="/queryapi") public class QueryServiceResource
queryapi resource This provides api for all things query.
| Field Summary | |
|---|---|
static org.apache.log4j.Logger |
LOG
The Constant LOG. |
| Constructor Summary | |
|---|---|
QueryServiceResource()
Instantiates a new query service resource. |
|
| Method Summary | |
|---|---|
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. |
QuerySubmitResult |
prepareQuery(LensSessionHandle sessionid,
String query,
String operation,
LensConf conf,
String queryName)
Prepare a query or 'explain and prepare' the query. |
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. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final org.apache.log4j.Logger LOG
| Constructor Detail |
|---|
public QueryServiceResource()
throws LensException
LensException - the lens exception| Method Detail |
|---|
@GET @Produces(value="text/plain") public String getMessage()
@GET
@Path(value="queries")
@Produces(value={"application/json","application/xml","text/plain"})
public List<QueryHandle> getAllQueries(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@DefaultValue(value="")@QueryParam(value="state")
String state,
@DefaultValue(value="")@QueryParam(value="queryName")
String queryName,
@DefaultValue(value="")@QueryParam(value="user")
String user,
@DefaultValue(value="-1")@QueryParam(value="fromDate")
long fromDate,
@DefaultValue(value="-1")@QueryParam(value="toDate")
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 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 objects
@POST
@Path(value="queries")
@Consumes(value="multipart/form-data")
@Produces(value={"application/json","application/xml","text/plain"})
public QuerySubmitResult query(LensSessionHandle sessionid,
String query,
String operation,
LensConf conf,
@DefaultValue(value="30000")
Long timeoutmillis,
@DefaultValue(value="")
String queryName)
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 ,
and conf - The configuration for the querytimeoutmillis - The timeout for the query, honored only in case of operationqueryName - human readable query name set by user (optional parameter)
QueryHandle in case of operation. QueryPlan in case of
operation. QueryHandleWithResultSet in case
operation.
@DELETE
@Path(value="queries")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult cancelAllQueries(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@DefaultValue(value="")@QueryParam(value="state")
String state,
@DefaultValue(value="")@QueryParam(value="user")
String user,
@DefaultValue(value="")@QueryParam(value="queryName")
String queryName,
@DefaultValue(value="-1")@QueryParam(value="fromDate")
long fromDate,
@DefaultValue(value="-1")@QueryParam(value="toDate")
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 The queries in
, ,
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)
@GET
@Path(value="preparedqueries")
@Produces(value={"application/json","application/xml","text/plain"})
public List<QueryPrepareHandle> getAllPreparedQueries(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@DefaultValue(value="")@QueryParam(value="user")
String user,
@DefaultValue(value="")@QueryParam(value="queryName")
String queryName,
@DefaultValue(value="-1")@QueryParam(value="fromDate")
long fromDate,
@DefaultValue(value="-1")@QueryParam(value="toDate")
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 time
@POST
@Path(value="preparedqueries")
@Consumes(value="multipart/form-data")
@Produces(value={"application/json","application/xml","text/plain"})
public QuerySubmitResult prepareQuery(LensSessionHandle sessionid,
String query,
@DefaultValue(value="")
String operation,
LensConf conf,
@DefaultValue(value="")
String queryName)
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 or
conf - The configuration for preparing the queryqueryName - human readable query name set by user (optional parameter)
QueryPrepareHandle incase of operation. QueryPlan incase of
and the query plan will contain the prepare handle as well.
@DELETE
@Path(value="preparedqueries")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult destroyPreparedQueries(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@DefaultValue(value="")@QueryParam(value="user")
String user,
@DefaultValue(value="")@QueryParam(value="queryName")
String queryName,
@DefaultValue(value="-1")@QueryParam(value="fromDate")
long fromDate,
@DefaultValue(value="-1")@QueryParam(value="toDate")
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 date
@GET
@Path(value="preparedqueries/{prepareHandle}")
@Produces(value={"application/json","application/xml","text/plain"})
public LensPreparedQuery getPreparedQuery(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="prepareHandle")
String prepareHandle)
sessionid - The user session handleprepareHandle - The prepare handle
LensPreparedQuery
@DELETE
@Path(value="preparedqueries/{prepareHandle}")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult destroyPrepared(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="prepareHandle")
String prepareHandle)
sessionid - The user session handleprepareHandle - The prepare handle
APIResult.Status.SUCCEEDED in case of successful destroy. APIResult with state
APIResult.Status.FAILED in case of destroy failure.
@GET
@Path(value="queries/{queryHandle}")
@Produces(value={"application/json","application/xml","text/plain"})
public LensQuery getStatus(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle)
sessionid - The user session handlequeryHandle - The query handle
LensQuery
@DELETE
@Path(value="queries/{queryHandle}")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult cancelQuery(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle)
sessionid - The user session handlequeryHandle - The query handle
@PUT
@Path(value="queries/{queryHandle}")
@Consumes(value="multipart/form-data")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult updateConf(LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle,
LensConf conf)
sessionid - The user session handlequeryHandle - The query handleconf - The new configuration, will be on top of old one
@PUT
@Path(value="preparedqueries/{prepareHandle}")
@Consumes(value="multipart/form-data")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult updatePreparedConf(LensSessionHandle sessionid,
@PathParam(value="prepareHandle")
String prepareHandle,
LensConf conf)
sessionid - The user session handleprepareHandle - The prepare handleconf - The new configuration, will be on top of old one
@POST
@Path(value="preparedqueries/{prepareHandle}")
@Consumes(value="multipart/form-data")
@Produces(value={"application/json","application/xml","text/plain"})
public QuerySubmitResult executePrepared(LensSessionHandle sessionid,
@PathParam(value="prepareHandle")
String prepareHandle,
@DefaultValue(value="EXECUTE")
String operation,
LensConf conf,
@DefaultValue(value="30000")
Long timeoutmillis,
@DefaultValue(value="")
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 and
conf - The configuration for the execution of querytimeoutmillis - The timeout for the query, honored only in case of operationqueryName - human readable query name set by user (optional parameter)
QueryHandle in case of operation. QueryHandleWithResultSet in
case operation.
@GET
@Path(value="queries/{queryHandle}/resultsetmetadata")
@Produces(value={"application/json","application/xml","text/plain"})
public QueryResultSetMetadata getResultSetMetadata(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle)
sessionid - The user session handlequeryHandle - The query handle
QueryResultSetMetadata
@GET
@Path(value="queries/{queryHandle}/resultset")
@Produces(value={"application/json","application/xml","text/plain"})
public QueryResult getResultSet(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle,
@QueryParam(value="fromindex")
long startIndex,
@QueryParam(value="fetchsize")
int fetchSize)
sessionid - The user session handlequeryHandle - The query handlestartIndex - start index of the resultfetchSize - fetch size
QueryResult
@GET
@Path(value="queries/{queryHandle}/httpresultset")
@Produces(value="application/octet-stream")
public javax.ws.rs.core.Response getHttpResultSet(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle)
sessionid - The user session handlequeryHandle - The query handle
@DELETE
@Path(value="queries/{queryHandle}/resultset")
@Produces(value={"application/json","application/xml","text/plain"})
public APIResult closeResultSet(@QueryParam(value="sessionid")
LensSessionHandle sessionid,
@PathParam(value="queryHandle")
String queryHandle)
sessionid - The user session handlequeryHandle - The query handle
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||