public class LensStatement extends Object
Constructor and Description |
---|
LensStatement(LensConnection connection) |
Modifier and Type | Method and Description |
---|---|
boolean |
closeResultSet()
Close result set.
|
boolean |
destroyPrepared(QueryPrepareHandle phandle)
Destroy prepared.
|
QueryHandle |
executeQuery(QueryPrepareHandle phandle,
boolean waitForQueryToComplete,
String queryName)
Deprecated.
|
QueryHandle |
executeQuery(QueryPrepareHandle phandle,
boolean waitForQueryToComplete,
String queryName,
LensConf conf)
This method can be used for executing a prepared query.
|
QueryHandle |
executeQuery(String sql,
boolean waitForQueryToComplete,
String queryName)
Deprecated.
|
QueryHandle |
executeQuery(String sql,
boolean waitForQueryToComplete,
String queryName,
LensConf conf)
This method can be used for executing a query.
|
QueryHandleWithResultSet |
executeQuery(String sql,
String queryName,
long timeOutMillis)
Deprecated.
|
QueryHandleWithResultSet |
executeQuery(String sql,
String queryName,
long timeOutMillis,
LensConf conf)
This method can be used for executing query.
|
LensAPIResult<QueryPlan> |
explainAndPrepare(String sql,
String queryName)
Deprecated.
|
LensAPIResult<QueryPlan> |
explainAndPrepare(String sql,
String queryName,
LensConf conf)
Explain and prepare.
|
LensAPIResult<QueryPlan> |
explainQuery(String sql)
Deprecated.
|
LensAPIResult<QueryPlan> |
explainQuery(String sql,
LensConf conf)
Explain query.
|
List<QueryPrepareHandle> |
getAllPreparedQueries(String userName,
String queryName,
String fromDate,
String toDate)
Gets the all prepared queries.
|
List<QueryHandle> |
getAllQueries(String state,
String queryName,
String user,
String driver,
String fromDate,
String toDate)
Gets the all queries.
|
List<LensQuery> |
getAllQueryDetails(String state,
String queryName,
String user,
String driver,
String fromDate,
String toDate)
Gets the all queries with details.
|
int |
getErrorCode()
Gets the error code, if any, for the most recently executed query.
|
String |
getErrorMessage()
Gets the error message, if any, for the most recently executed query.
|
javax.ws.rs.core.Response |
getHttpResultSet()
Gets http result set for the most recently executed query.
|
javax.ws.rs.core.Response |
getHttpResultSet(LensQuery query)
Gets the http result set.
|
LensPreparedQuery |
getPreparedQuery(QueryPrepareHandle handle)
Gets the prepared query.
|
LensQuery |
getQuery()
Gets details of the most recently executed query through
executeQuery(QueryPrepareHandle, boolean, String)
or executeQuery(String, boolean, String) or executeQuery(String, String, long) |
LensQuery |
getQuery(QueryHandle handle)
Gets the query.
|
String |
getQueryHandleString()
Gets the query handle string for the most recently executed query.
|
QueryResult |
getResultSet()
Gets result set for the most recently executed query.
|
QueryResult |
getResultSet(LensQuery query)
Gets the result set.
|
QueryResultSetMetadata |
getResultSetMetaData()
Gets the result set meta data for the most recently executed query.
|
QueryResultSetMetadata |
getResultSetMetaData(LensQuery query)
Gets the result set meta data.
|
QueryStatus |
getStatus()
Gets the status for the most recently executed query.
|
QueryStatus |
getStatus(QueryHandle handle)
Gets status for query represented by handle.
|
String |
getUser()
Gets the user for the lens session
|
boolean |
isIdle() |
boolean |
kill()
Kill the most recently submitted query via any executeQuery methods.
|
boolean |
kill(LensQuery query)
Kill.
|
LensAPIResult<QueryPrepareHandle> |
prepareQuery(String sql,
String queryName)
Deprecated.
|
LensAPIResult<QueryPrepareHandle> |
prepareQuery(String sql,
String queryName,
LensConf conf)
Prepare query.
|
void |
waitForQueryToComplete(QueryHandle handle) |
boolean |
wasQuerySuccessful()
Was the most recently executed query successful.
|
@ConstructorProperties(value="connection") @Generated(value="lombok") public LensStatement(LensConnection connection)
@Deprecated public QueryHandle executeQuery(String sql, boolean waitForQueryToComplete, String queryName) throws LensAPIException
getStatus(QueryHandle)
can be used to track to track the query progress and
getQuery(QueryHandle)
can be used to get complete details (including status) about the query.
sql
- the sqlwaitForQueryToComplete
- the wait for query to completequeryName
- the query nameLensAPIException
public QueryHandle executeQuery(String sql, boolean waitForQueryToComplete, String queryName, LensConf conf) throws LensAPIException
getStatus(QueryHandle)
can be used to track to track the query progress and
getQuery(QueryHandle)
can be used to get complete details (including status) about the query.
sql
- the sqlwaitForQueryToComplete
- the wait for query to completequeryName
- the query nameconf
- config specific to this queryLensAPIException
@Deprecated public QueryHandle executeQuery(QueryPrepareHandle phandle, boolean waitForQueryToComplete, String queryName)
getStatus(QueryHandle)
can be used to track to track the query progress and
getQuery(QueryHandle)
can be used to get complete details (including status) about the query.
phandle
- the prepared query handlewaitForQueryToComplete
- the wait for query to completequeryName
- the query namepublic QueryHandle executeQuery(QueryPrepareHandle phandle, boolean waitForQueryToComplete, String queryName, LensConf conf)
getStatus(QueryHandle)
can be used to track to track the query progress and
getQuery(QueryHandle)
can be used to get complete details (including status) about the query.
phandle
- the prepared query handlewaitForQueryToComplete
- the wait for query to completequeryName
- the query nameconf
- config to be used for the query@Deprecated public QueryHandleWithResultSet executeQuery(String sql, String queryName, long timeOutMillis) throws LensAPIException
If the query execution finishes before timeout, user can check the query Status (SUCCESSFUL/FAILED) using
QueryHandleWithResultSet.getStatus()
and access the result of SUCCESSFUL query via
QueryHandleWithResultSet.getResult()
and QueryHandleWithResultSet.getResultMetadata()
.
If the query does not finish within the timeout, user can use getStatus(QueryHandle)
to track
the query progress and getQuery(QueryHandle)
to get complete details (including status) about
the query. Once the query has reached SUCCESSFUL state, user can access the results via
getResultSet(LensQuery)
and getResultSetMetaData(LensQuery)
sql
- : query/command to be executedqueryName
- : optional query nametimeOutMillis
- : timeout millisecondsLensAPIException
public QueryHandleWithResultSet executeQuery(String sql, String queryName, long timeOutMillis, LensConf conf) throws LensAPIException
If the query execution finishes before timeout, user can check the query Status (SUCCESSFUL/FAILED) using
QueryHandleWithResultSet.getStatus()
and access the result of SUCCESSFUL query via
QueryHandleWithResultSet.getResult()
and QueryHandleWithResultSet.getResultMetadata()
.
If the query does not finish within the timeout, user can use getStatus(QueryHandle)
to track
the query progress and getQuery(QueryHandle)
to get complete details (including status) about
the query. Once the query has reached SUCCESSFUL state, user can access the results via
getResultSet(LensQuery)
and getResultSetMetaData(LensQuery)
sql
- : query/command to be executedqueryName
- : optional query nametimeOutMillis
- : timeout millisecondsconf
- config to be used for the queryLensAPIException
@Deprecated public LensAPIResult<QueryPrepareHandle> prepareQuery(String sql, String queryName) throws LensAPIException
sql
- the sqlqueryName
- the query nameLensAPIException
public LensAPIResult<QueryPrepareHandle> prepareQuery(String sql, String queryName, LensConf conf) throws LensAPIException
sql
- the sqlqueryName
- the query nameLensAPIException
@Deprecated public LensAPIResult<QueryPlan> explainAndPrepare(String sql, String queryName) throws LensAPIException
sql
- the sqlqueryName
- the query nameLensAPIException
public LensAPIResult<QueryPlan> explainAndPrepare(String sql, String queryName, LensConf conf) throws LensAPIException
sql
- the sqlqueryName
- the query nameconf
- config to be used for the queryLensAPIException
public void waitForQueryToComplete(QueryHandle handle)
public LensQuery getQuery(QueryHandle handle)
handle
- the handlepublic LensPreparedQuery getPreparedQuery(QueryPrepareHandle handle)
handle
- the handle@Deprecated public LensAPIResult<QueryPlan> explainQuery(String sql) throws LensAPIException
sql
- the sqlLensAPIException
public LensAPIResult<QueryPlan> explainQuery(String sql, LensConf conf) throws LensAPIException
sql
- the sqlconf
- config to be used for the queryLensAPIException
public List<QueryHandle> getAllQueries(String state, String queryName, String user, String driver, String fromDate, String toDate)
state
- the statequeryName
- the query nameuser
- the userdriver
- the driver namefromDate
- the from datetoDate
- the to datepublic List<LensQuery> getAllQueryDetails(String state, String queryName, String user, String driver, String fromDate, String toDate)
state
- the statequeryName
- the query nameuser
- the userdriver
- the driver namefromDate
- the from datetoDate
- the to datepublic List<QueryPrepareHandle> getAllPreparedQueries(String userName, String queryName, String fromDate, String toDate)
userName
- the user namequeryName
- the query namefromDate
- the from datetoDate
- the to datepublic QueryResultSetMetadata getResultSetMetaData()
public QueryResultSetMetadata getResultSetMetaData(LensQuery query)
query
- the querypublic QueryResult getResultSet()
public javax.ws.rs.core.Response getHttpResultSet()
public QueryResult getResultSet(LensQuery query)
query
- the querypublic javax.ws.rs.core.Response getHttpResultSet(LensQuery query)
query
- the querypublic boolean kill()
public boolean kill(LensQuery query)
query
- the querypublic boolean closeResultSet()
public boolean destroyPrepared(QueryPrepareHandle phandle)
phandle
- the phandlepublic boolean isIdle()
public boolean wasQuerySuccessful()
public QueryStatus getStatus(QueryHandle handle)
public QueryStatus getStatus()
public LensQuery getQuery()
executeQuery(QueryPrepareHandle, boolean, String)
or executeQuery(String, boolean, String)
or executeQuery(String, String, long)
Note: Cached query details are returned if the query has finished. If the query has still not finished it fetches the latest details from server again.
public int getErrorCode()
public String getErrorMessage()
public String getQueryHandleString()
public String getUser()
Copyright © 2014–2018 Apache Software Foundation. All rights reserved.