QueryServiceResource
queryapi resource
This provides api for all things query.The following resources are applicable:
- /queryapi
- /queryapi/preparedqueries
- /queryapi/preparedqueries/{prepareHandle}
- /queryapi/queries
- /queryapi/queries/{queryHandle}
- /queryapi/queries/{queryHandle}/httpresultset
- /queryapi/queries/{queryHandle}/resultset
- /queryapi/queries/{queryHandle}/resultsetmetadata
/queryapi
Mount Point: /queryapi
GET
API to know if Query service is up and running
Response Body
element: | (custom) |
media types: | text/plain |
Simple text saying it up
/queryapi/preparedqueries
Mount Point: /queryapi/preparedqueries
The following operations are supported on this resource:
GET
Get all prepared queries in the query server; can be filtered with user.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The sessionid in which user is working | query | |
user | returns queries of the user. If set to "all", returns queries of all users. By default returns the queries of the current user. | query | |
queryName | returns queries matching the query name | query | |
fromDate | start time for filtering prepared queries by preparation time | query | -1 |
toDate | end time for filtering prepared queries by preparation time | query | -1 |
Response Body
element: | (custom) |
media types: | application/xml text/plain application/json |
List of QueryPrepareHandle objects
POST
Prepare a query or 'explain and prepare' the query.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The session in which user is preparing the query. Any configuration set in the session will be picked up. | formdata | |
query | The query to prepare | formdata | |
operation | The operation on the query. Supported operations are org.apache.lens.api.query.SubmitOp#EXPLAIN_AND_PREPARE or org.apache.lens.api.query.SubmitOp#PREPARE | formdata | |
conf | The configuration for preparing the query | formdata | |
queryName | human readable query name set by user (optional parameter) | formdata |
Response Body
element: | lensAPIResult |
media types: | application/xml text/plain application/json |
QueryPrepareHandle incase of {link org.apache.lens.api.query.SubmitOp#PREPARE} operation. QueryPlan incase of org.apache.lens.api.query.SubmitOp#EXPLAIN_AND_PREPARE and the query plan will contain the prepare handle as well.
DELETE
Destroy all the prepared queries; Can be filtered with user.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The session in which cancel is issued | query | |
user | destroys queries of the user. If set to "all", destroys queries of all users. By default destroys the queries of the current user. | query | |
queryName | destroys queries matching the query name | query | |
fromDate | the from date | query | -1 |
toDate | the to date | query | -1 |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful destroy. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of destroy failure. APIResult with state org.apache.lens.api.APIResult.Status#PARTIAL in case of partial destroy.
/queryapi/preparedqueries/{prepareHandle}
Mount Point: /queryapi/preparedqueries/{prepareHandle}
The following operations are supported on this resource:
GET
Get a prepared query specified by handle.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
prepareHandle | The prepare handle | path |
Response Body
element: | lensPreparedQuery |
media types: | application/xml text/plain application/json |
LensPreparedQuery
DELETE
Destroy the prepared query specified by handle.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
prepareHandle | The prepare handle | path |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful destroy. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of destroy failure.
PUT
Modify prepared query's configuration. This would be picked up for subsequent runs of the prepared queries. The query wont be re-prepared with new configuration.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | formdata | |
prepareHandle | The prepare handle | path | |
conf | The new configuration, will be on top of old one | formdata |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful update. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of udpate failure.
POST
Submit prepared query for execution.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The session in which user is submitting the query. Any configuration set in the session will be picked up. | formdata | |
prepareHandle | The Query to run | path | |
operation | The operation on the query. Supported operations are org.apache.lens.api.query.SubmitOp#EXECUTE and | formdata | EXECUTE |
conf | The configuration for the execution of query | formdata | |
timeoutmillis | The timeout for the query, honored only in case of org.apache.lens.api.query.SubmitOp#EXECUTE_WITH_TIMEOUT operation | formdata | 30000 |
queryName | human readable query name set by user (optional parameter) | formdata |
Response Body
element: | querySubmitResult |
media types: | application/xml text/plain application/json |
QueryHandle in case of {link org.apache.lens.api.query.SubmitOp#EXECUTE} operation. QueryHandleWithResultSet in case {@link org.apache.lens.api.query.SubmitOp#EXECUTE_WITH_TIMEOUT } operation.
/queryapi/queries
Mount Point: /queryapi/queries
The following operations are supported on this resource:
GET
Get all the queries in the query server; can be filtered with state and queryName. This will by default only return queries submitted by the user that has started the session. To get queries of all users, set the searchAllUsers parameter to false.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The sessionid in which queryName is working | query | |
state | 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()} | query | |
queryName | If any queryName is passed, all the queries containing the queryName will be returned, otherwise all the queries will be returned | query | |
user | Returns queries submitted by this user. If set to "all", returns queries of all users. By default, returns queries of the current user. | query | |
driver | Get queries submitted on a specific driver. | query | |
fromDate | from date to search queries in a time range, the range is inclusive(submitTime >= fromDate) | query | -1 |
toDate | to date to search queries in a time range, the range is inclusive(toDate >= submitTime) | query | -1 |
Response Body
element: | (custom) |
media types: | application/xml text/plain application/json |
List of QueryHandle objects
POST
Submit the query for explain or execute or execute with a timeout.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The session in which user is submitting the query. Any configuration set in the session will be picked up. | formdata | |
query | The query to run | formdata | |
operation | The operation on the query. Supported operations are values: org.apache.lens.api.query.SubmitOp#ESTIMATE, org.apache.lens.api.query.SubmitOp#EXPLAIN, org.apache.lens.api.query.SubmitOp#EXECUTE and org.apache.lens.api.query.SubmitOp#EXECUTE_WITH_TIMEOUT | formdata | |
conf | The configuration for the query | formdata | |
timeoutmillis | The timeout for the query, honored only in case of value operation | formdata | 30000 |
queryName | human readable query name set by user (optional parameter) | formdata |
Response Body
element: | lensAPIResult |
media types: | application/xml text/plain application/json |
LensAPIResult with DATA as QueryHandle in case of org.apache.lens.api.query.SubmitOp#EXECUTE operation. QueryPlan in case of org.apache.lens.api.query.SubmitOp#EXPLAIN operation. QueryHandleWithResultSet in case org.apache.lens.api.query.SubmitOp#EXECUTE_WITH_TIMEOUT operation. org.apache.lens.api.result.QueryCostTO in case of org.apache.lens.api.query.SubmitOp#ESTIMATE operation.
DELETE
Cancel all the queries in query server; can be filtered with state and user.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The session in which cancel is issued | query | |
state | If any state is passed, all the queries in that state will be cancelled, otherwise all queries will be cancelled. Possible states are org.apache.lens.api.query.QueryStatus.Status#values() The queries in org.apache.lens.api.query.QueryStatus.Status#FAILED, org.apache.lens.api.query.QueryStatus.Status#CLOSED, org.apache.lens.api.query.QueryStatus.Status#SUCCESSFUL cannot be cancelled | query | |
user | If any user is passed, all the queries submitted by the user will be cancelled, otherwise all the queries will be cancelled | query | |
queryName | Cancel queries matching the query name | query | |
driver | Get queries submitted on a specific driver. | query | |
fromDate | the from date, inclusive(submitTime>=fromDate) | query | -1 |
toDate | the to date, inclusive(toDate>=submitTime) | query | -1 |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful cancellation. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of cancellation failure. APIResult with state org.apache.lens.api.APIResult.Status#PARTIAL in case of partial cancellation.
/queryapi/queries/{queryHandle}
Mount Point: /queryapi/queries/{queryHandle}
The following operations are supported on this resource:
GET
Get lens query and its current status.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
queryHandle | The query handle | path |
Response Body
element: | lensQuery |
media types: | application/xml text/plain application/json |
LensQuery
DELETE
Cancel the query specified by the handle.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
queryHandle | The query handle | path |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful cancellation. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of cancellation failure.
PUT
Modify query configuration if it is not running yet.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | formdata | |
queryHandle | The query handle | path | |
conf | The new configuration, will be on top of old one | formdata |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful update. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of udpate failure.
/queryapi/queries/{queryHandle}/httpresultset
Mount Point: /queryapi/queries/{queryHandle}/httpresultset
GET
Get the http endpoint for result set.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
queryHandle | The query handle | path |
Response Body
element: | (custom) |
media types: | application/octet-stream |
Response with result as octet stream
/queryapi/queries/{queryHandle}/resultset
Mount Point: /queryapi/queries/{queryHandle}/resultset
GET
Fetch the result set.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
queryHandle | The query handle | path | |
fromindex | start index of the result | query | |
fetchsize | fetch size | query |
Response Body
element: | queryResult |
media types: | application/xml text/plain application/json |
QueryResult
DELETE
Close the result set once fetching is done.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
queryHandle | The query handle | path |
Response Body
element: | APIResult |
media types: | application/xml text/plain application/json |
APIResult with state org.apache.lens.api.APIResult.Status#SUCCEEDED in case of successful close. APIResult with state org.apache.lens.api.APIResult.Status#FAILED in case of close failure.
/queryapi/queries/{queryHandle}/resultsetmetadata
Mount Point: /queryapi/queries/{queryHandle}/resultsetmetadata
GET
Get resultset metadata of the query.
Parameters
name | description | type | default |
---|---|---|---|
sessionid | The user session handle | query | |
queryHandle | The query handle | path |
Response Body
element: | queryResultSetMetadata |
media types: | application/xml text/plain application/json |
QueryResultSetMetadata