This project has retired. For details please refer to its Attic page.
Lens Server: QueryServiceResource

QueryServiceResource Resource

queryapi resource

This provides api for all things query.

GET /queryapi

API to know if Query service is up and running

Response Body
media type data type description
text/plain (custom) Simple text saying it up

Example

Request
GET /queryapi
Accept: text/plain

              
Response
HTTP/1.1 200 OK
Content-Type: text/plain

                
...
                
              

GET /queryapi/queries

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.

Request Parameters
name type description
driver query Get queries submitted on a specific driver.
fromDate query from date to search queries in a time range, the range is inclusive(submitTime >= fromDate) from date can be a long value indicating timestamp, or it can be in a format acceptable in time_range_in function. Notably: yyyy[-MM[-dd[-HH-[mm...]]]], or now based relative format
queryName query If any queryName is passed, all the queries containing the queryName will be returned, otherwise all the queries will be returned
sessionid query The sessionid in which queryName is working
state query 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()}. Multiple states can be passed as comma separated string
toDate query to date to search queries in a time range, the range is inclusive(toDate > submitTime) possible formats it can take is same as fromDate
user query Returns queries submitted by this user. If set to "all", returns queries of all users. By default, returns queries of the current user.
Response Body
media type data type description
application/json array of array of QueryHandle (JSON) List of QueryHandle objects
application/json array of array of QueryHandle (JSON)
application/xml list of queryHandle (XML)
text/plain (custom)

Example

Request
GET /queryapi/queries
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "handleIdString" : "...",
  "handleId" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/queries/detail

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.

Request Parameters
name type description
driver query Get queries submitted on a specific driver.
fromDate query from date to search queries in a time range, the range is inclusive(submitTime >= fromDate) from date can be a long value indicating timestamp, or it can be in a format acceptable in time_range_in function. Notably: yyyy[-MM[-dd[-HH-[mm...]]]], or now based relative format
queryName query If any queryName is passed, all the queries containing the queryName will be returned, otherwise all the queries will be returned
sessionid query The sessionid in which queryName is working
state query 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()}. Multiple states can be passed as comma separated string
toDate query to date to search queries in a time range, the range is inclusive(toDate > submitTime) possible formats it can take is same as fromDate
user query Returns queries submitted by this user. If set to "all", returns queries of all users. By default, returns queries of the current user.
Response Body
media type data type description
application/json array of array of LensQuery (JSON) List of LensQuery objects
application/json array of array of LensQuery (JSON)
application/xml list of lensQuery (XML)
text/plain (custom)

Example

Request
GET /queryapi/queries/detail
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "errorCode" : 12345,
  "errorMessage" : "...",
  "queryHandleString" : "...",
  "queryHandle" : {
    "handleIdString" : "...",
    "handleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "userQuery" : "...",
  "submittedUser" : "...",
  "priority" : "VERY_HIGH",
  "persistent" : true,
  "selectedDriverName" : "...",
  "driverQuery" : "...",
  "status" : {
    "errorCode" : 12345,
    "lensErrorTOErrorMsg" : "...",
    "queuedStatus" : { },
    "progress" : 12345.0,
    "queueNumber" : 12345,
    "status" : "CANCELED",
    "statusMessage" : "...",
    "resultSetAvailable" : true,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "lensErrorTO" : {
      "payload" : { },
      "childErrors" : [ [ { }, { } ], [ { }, { } ] ],
      "message" : "...",
      "code" : 12345
    },
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "resultSetPath" : "...",
  "driverOpHandle" : "...",
  "queryConf" : {
    "properties" : {
      "property1" : "...",
      "property2" : "..."
    },
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "submissionTime" : 12345,
  "launchTime" : 12345,
  "driverStartTime" : 12345,
  "driverFinishTime" : 12345,
  "finishTime" : 12345,
  "closedTime" : 12345,
  "queryName" : "...",
  "failedAttempts" : [ [ {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  }, {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  } ], [ {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  }, {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  } ] ],
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

POST /queryapi/queries

Submit the query for explain or execute or execute with a timeout.

Request Parameters
name type description default constraints
conf formdata The configuration for the query    
operation formdata 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    
query formdata The query to run    
queryName formdata human readable query name set by user (optional parameter)  
sessionid formdata The session in which user is submitting the query. Any configuration set in the session will be picked up.    
timeoutmillis formdata The timeout for the query. If the query does not finish within the specified timeout, it is automatically cancelled unless user specified otherwise by setting configuration lens.query.cancel.on.timeout = false.
Note: The timeout parameter is honored only in case of operation
30000 long
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json LensAPIResult (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.
application/json LensAPIResult (JSON)
application/xml lensAPIResult (XML)
text/plain (custom)

Example

Request
POST /queryapi/queries
Accept: application/json

              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "httpStatusCode" : { },
  "successResult" : true,
  "errorResult" : true,
  "errorCode" : 12345,
  "errorMessage" : "...",
  "id" : "...",
  "data" : { },
  "lensErrorTO" : {
    "payload" : { },
    "childErrors" : [ [ { }, { } ], [ { }, { } ] ],
    "message" : "...",
    "code" : 12345
  }
}
                
              

DELETE /queryapi/queries

Cancel all the queries in query server; can be filtered with state and user.

Request Parameters
name type description default
driver query Get queries submitted on a specific driver.
fromDate query the from date, inclusive(submitTime>=fromDate)  
queryName query Cancel queries matching the query name
sessionid query The session in which cancel is issued  
state query 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
toDate query the to date, inclusive(toDate>=submitTime)  
user query If any user is passed, all the queries submitted by the user will be cancelled, otherwise all the queries will be cancelled
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /queryapi/queries
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "PARTIAL",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/preparedqueries

Get all prepared queries in the query server; can be filtered with user.

Request Parameters
name type description default
fromDate query start time for filtering prepared queries by preparation time  
queryName query returns queries matching the query name
sessionid query The sessionid in which user is working  
toDate query end time for filtering prepared queries by preparation time  
user query returns queries of the user. If set to "all", returns queries of all users. By default returns the queries of the current user.
Response Body
media type data type description
application/json array of array of QueryPrepareHandle (JSON) List of QueryPrepareHandle objects
application/json array of array of QueryPrepareHandle (JSON)
application/xml list of queryPrepareHandle (XML)
text/plain (custom)

Example

Request
GET /queryapi/preparedqueries
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "queryHandleString" : "...",
  "prepareHandleId" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

POST /queryapi/preparedqueries

Prepare a query or 'explain and prepare' the query.

Request Parameters
name type description default
conf formdata The configuration for preparing the query  
operation formdata 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
query formdata The query to prepare  
queryName formdata human readable query name set by user (optional parameter)
sessionid formdata The session in which user is preparing the query. Any configuration set in the session will be picked up.  
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json LensAPIResult (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.
application/json LensAPIResult (JSON)
application/xml lensAPIResult (XML)
text/plain (custom)

Example

Request
POST /queryapi/preparedqueries
Accept: application/json

              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "httpStatusCode" : { },
  "successResult" : true,
  "errorResult" : true,
  "errorCode" : 12345,
  "errorMessage" : "...",
  "id" : "...",
  "data" : { },
  "lensErrorTO" : {
    "payload" : { },
    "childErrors" : [ [ { }, { } ], [ { }, { } ] ],
    "message" : "...",
    "code" : 12345
  }
}
                
              

DELETE /queryapi/preparedqueries

Destroy all the prepared queries; Can be filtered with user.

Request Parameters
name type description default
fromDate query the from date  
queryName query destroys queries matching the query name
sessionid query The session in which cancel is issued  
toDate query the to date  
user query destroys queries of the user. If set to "all", destroys queries of all users. By default destroys the queries of the current user.
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /queryapi/preparedqueries
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "SUCCEEDED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/preparedqueries/{prepareHandle}

Get a prepared query specified by handle.

Request Parameters
name type description
prepareHandle path The prepare handle
sessionid query The user session handle
Response Body
media type data type description
application/json LensPreparedQuery (JSON) LensPreparedQuery
application/json LensPreparedQuery (JSON)
application/xml lensPreparedQuery (XML)
text/plain (custom)

Example

Request
GET /queryapi/preparedqueries/{prepareHandle}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "prepareHandle" : {
    "queryHandleString" : "...",
    "prepareHandleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "userQuery" : "...",
  "preparedTime" : 12345,
  "preparedUser" : "...",
  "selectedDriverName" : "...",
  "driverQuery" : "...",
  "conf" : {
    "properties" : {
      "property1" : "...",
      "property2" : "..."
    },
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

DELETE /queryapi/preparedqueries/{prepareHandle}

Destroy the prepared query specified by handle.

Request Parameters
name type description
prepareHandle path The prepare handle
sessionid query The user session handle
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /queryapi/preparedqueries/{prepareHandle}
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "SUCCEEDED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/queries/{queryHandle}

Get lens query and its current status.

Request Parameters
name type description
queryHandle path The query handle
sessionid query The user session handle
Response Body
media type data type description
application/json LensQuery (JSON) LensQuery
application/json LensQuery (JSON)
application/xml lensQuery (XML)
text/plain (custom)

Example

Request
GET /queryapi/queries/{queryHandle}
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "errorCode" : 12345,
  "errorMessage" : "...",
  "queryHandleString" : "...",
  "queryHandle" : {
    "handleIdString" : "...",
    "handleId" : "...",
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "userQuery" : "...",
  "submittedUser" : "...",
  "priority" : "NORMAL",
  "persistent" : true,
  "selectedDriverName" : "...",
  "driverQuery" : "...",
  "status" : {
    "errorCode" : 12345,
    "lensErrorTOErrorMsg" : "...",
    "queuedStatus" : { },
    "progress" : 12345.0,
    "queueNumber" : 12345,
    "status" : "FAILING",
    "statusMessage" : "...",
    "resultSetAvailable" : true,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "lensErrorTO" : {
      "payload" : { },
      "childErrors" : [ [ { }, { } ], [ { }, { } ] ],
      "message" : "...",
      "code" : 12345
    },
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "resultSetPath" : "...",
  "driverOpHandle" : "...",
  "queryConf" : {
    "properties" : {
      "property1" : "...",
      "property2" : "..."
    },
    "fieldsToAppend" : [ [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ], [ {
      "name" : "...",
      "value" : { }
    }, {
      "name" : "...",
      "value" : { }
    } ] ]
  },
  "submissionTime" : 12345,
  "launchTime" : 12345,
  "driverStartTime" : 12345,
  "driverFinishTime" : 12345,
  "finishTime" : 12345,
  "closedTime" : 12345,
  "queryName" : "...",
  "failedAttempts" : [ [ {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  }, {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  } ], [ {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  }, {
    "driverName" : "...",
    "progress" : 12345.0,
    "progressMessage" : "...",
    "errorMessage" : "...",
    "driverStartTime" : 12345,
    "driverFinishTime" : 12345
  } ] ],
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

DELETE /queryapi/queries/{queryHandle}

Cancel the query specified by the handle.

Request Parameters
name type description
queryHandle path The query handle
sessionid query The user session handle
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /queryapi/queries/{queryHandle}
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "PARTIAL",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

PUT /queryapi/queries/{queryHandle}

Modify query configuration if it is not running yet.

Request Parameters
name type description
conf formdata The new configuration, will be on top of old one
sessionid formdata The user session handle
queryHandle path The query handle
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
PUT /queryapi/queries/{queryHandle}
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "FAILED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

PUT /queryapi/preparedqueries/{prepareHandle}

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.

Request Parameters
name type description
conf formdata The new configuration, will be on top of old one
sessionid formdata The user session handle
prepareHandle path The prepare handle
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
PUT /queryapi/preparedqueries/{prepareHandle}
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "FAILED",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

POST /queryapi/preparedqueries/{prepareHandle}

Submit prepared query for execution.

Request Parameters
name type description default constraints
conf formdata The configuration for the execution of query    
operation formdata The operation on the query. Supported operations are org.apache.lens.api.query.SubmitOp#EXECUTE and EXECUTE  
queryName formdata human readable query name set by user (optional parameter)  
sessionid formdata The session in which user is submitting the query. Any configuration set in the session will be picked up.    
timeoutmillis formdata The timeout for the query, honored only in case of org.apache.lens.api.query.SubmitOp#EXECUTE_WITH_TIMEOUT operation 30000 long
prepareHandle path The Query to run    
Request Body
media type data type
multipart/form-data (custom)
Response Body
media type data type description
application/json QuerySubmitResult (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.
application/json QuerySubmitResult (JSON)
application/xml querySubmitResult (XML)
text/plain (custom)

Example

Request
POST /queryapi/preparedqueries/{prepareHandle}
Accept: application/json

              
Response
HTTP/1.1 201 Created
Content-Type: application/json

                
{
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/queries/{queryHandle}/resultsetmetadata

Get resultset metadata of the query.

Request Parameters
name type description
queryHandle path The query handle
sessionid query The user session handle
Response Body
media type data type description
application/json QueryResultSetMetadata (JSON) QueryResultSetMetadata
application/json QueryResultSetMetadata (JSON)
application/xml queryResultSetMetadata (XML)
text/plain (custom)

Example

Request
GET /queryapi/queries/{queryHandle}/resultsetmetadata
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "columns" : [ [ {
    "name" : "...",
    "type" : "DATE"
  }, {
    "name" : "...",
    "type" : "BINARY"
  } ], [ {
    "name" : "...",
    "type" : "DECIMAL"
  }, {
    "name" : "...",
    "type" : "DECIMAL"
  } ] ],
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/queries/{queryHandle}/resultset

Fetch the result set.

Request Parameters
name type description constraints
queryHandle path The query handle  
fetchsize query fetch size int
fromindex query start index of the result long
sessionid query The user session handle  
Response Body
media type data type description
application/json QueryResult (JSON) QueryResult
application/json QueryResult (JSON)
application/xml queryResult (XML)
text/plain (custom)

Example

Request
GET /queryapi/queries/{queryHandle}/resultset
Accept: application/json

              
Response
HTTP/1.1 200 OK
Content-Type: application/json

                
{
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}
                
              

GET /queryapi/queries/{queryHandle}/httpresultset

Get the http endpoint for result set.

Request Parameters
name type description
queryHandle path The query handle
sessionid query The user session handle
Response Body
media type data type description
application/octet-stream (custom) Response with result as octet stream

Example

Request
GET /queryapi/queries/{queryHandle}/httpresultset
Accept: application/octet-stream

              
Response
HTTP/1.1 200 OK
Content-Type: application/octet-stream

                
...
                
              

DELETE /queryapi/queries/{queryHandle}/resultset

Close the result set once fetching is done.

Request Parameters
name type description
queryHandle path The query handle
sessionid query The user session handle
Response Body
media type data type description
application/json APIResult (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.
application/json APIResult (JSON)
application/xml APIResult (XML)
text/plain (custom)

Example

Request
DELETE /queryapi/queries/{queryHandle}/resultset
Accept: application/json

              
Response
HTTP/1.1 204 No Content
Content-Type: application/json

                
{
  "status" : "PARTIAL",
  "message" : "...",
  "fieldsToAppend" : [ [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ], [ {
    "name" : "...",
    "value" : { }
  }, {
    "name" : "...",
    "value" : { }
  } ] ]
}