This project has retired. For details please refer to its Attic page.
QueryExecutionService (Lens 2.0.1-beta-incubating API)

org.apache.lens.server.api.query
Interface QueryExecutionService

All Known Implementing Classes:
QueryExecutionServiceImpl

public interface QueryExecutionService

The Interface QueryExecutionService.


Field Summary
static String NAME
          The Constant NAME.
 
Method Summary
 boolean cancelQuery(LensSessionHandle sessionHandle, QueryHandle queryHandle)
          Cancel the execution of the query, specified by the handle.
 void closeResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle)
          Closes result set by releasing any resources used in serving the resultset.
 boolean destroyPrepared(LensSessionHandle sessionHandle, QueryPrepareHandle prepared)
          Destroy a prepared query.
 QueryHandleWithResultSet execute(LensSessionHandle sessionHandle, String query, long timeoutmillis, LensConf conf, String queryName)
          Execute the query with a timeout.
 QueryHandle executeAsync(LensSessionHandle sessionHandle, String query, LensConf conf, String queryName)
          Asynchronously execute the query.
 QueryHandleWithResultSet executePrepare(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, long timeoutmillis, LensConf conf, String queryName)
          Execute already prepared query with timeout.
 QueryHandle executePrepareAsync(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, LensConf conf, String queryName)
          Execute already prepared query asynchronously.
 QueryPlan explain(LensSessionHandle sessionHandle, String query, LensConf conf)
          Explain the given query.
 QueryPlan explainAndPrepare(LensSessionHandle sessionHandle, String query, LensConf conf, String queryName)
          Explain the given query and prepare it as well.
 QueryResult fetchResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle, long startIndex, int fetchSize)
          Fetch the results of the query, specified by the handle.
 List<QueryPrepareHandle> getAllPreparedQueries(LensSessionHandle sessionHandle, String user, String queryName, long fromDate, long toDate)
          Returns all the prepared queries for the specified user.
 List<QueryHandle> getAllQueries(LensSessionHandle sessionHandle, String state, String user, String queryName, long fromDate, long toDate)
          Returns all the queries in the specified state, for the given user and matching query name.
 long getFinishedQueriesCount()
          Get finished queries count
 javax.ws.rs.core.Response getHttpResultSet(LensSessionHandle sessionHandle, QueryHandle queryHandle)
          Get the http end point for the result set.
 LensPreparedQuery getPreparedQuery(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle)
          Get prepared query.
 LensQuery getQuery(LensSessionHandle sessionHandle, QueryHandle queryHandle)
          Get the query, specified by the handle.
 long getQueuedQueriesCount()
          Get queued queries count
 QueryResultSetMetadata getResultSetMetadata(LensSessionHandle sessionHandle, QueryHandle queryHandle)
          Get the result set metadata - list of columns(names and types) and result size.
 long getRunningQueriesCount()
          Get running queries count
 QueryPrepareHandle prepare(LensSessionHandle sessionHandle, String query, LensConf conf, String queryName)
          Prepare the query.
 boolean updateQueryConf(LensSessionHandle sessionHandle, QueryHandle queryHandle, LensConf newconf)
          Update the query conf.
 boolean updateQueryConf(LensSessionHandle sessionHandle, QueryPrepareHandle prepareHandle, LensConf newconf)
          Update configuration for prepared query.
 

Field Detail

NAME

static final String NAME
The Constant NAME.

See Also:
Constant Field Values
Method Detail

explain

QueryPlan explain(LensSessionHandle sessionHandle,
                  String query,
                  LensConf conf)
                  throws LensException
Explain the given query.

Parameters:
sessionHandle - the session handle
query - The query should be in HiveQL(SQL like)
conf - The query configuration
Returns:
The query plan;
Throws:
LensException - the lens exception

prepare

QueryPrepareHandle prepare(LensSessionHandle sessionHandle,
                           String query,
                           LensConf conf,
                           String queryName)
                           throws LensException
Prepare the query.

Parameters:
sessionHandle - the session handle
query - The query should be in HiveQL(SQL like)
conf - The query configuration
queryName - the query name
Returns:
Prepare handle
Throws:
LensException - the lens exception

explainAndPrepare

QueryPlan explainAndPrepare(LensSessionHandle sessionHandle,
                            String query,
                            LensConf conf,
                            String queryName)
                            throws LensException
Explain the given query and prepare it as well.

Parameters:
sessionHandle - the session handle
query - The query should be in HiveQL(SQL like)
conf - The query configuration
queryName - the query name
Returns:
The query plan; Query plan also consists of prepare handle, if it should be used to executePrepare
Throws:
LensException - the lens exception

executePrepareAsync

QueryHandle executePrepareAsync(LensSessionHandle sessionHandle,
                                QueryPrepareHandle prepareHandle,
                                LensConf conf,
                                String queryName)
                                throws LensException
Execute already prepared query asynchronously. Query can be prepared with explain

Parameters:
sessionHandle - the session handle
prepareHandle - The QueryPrepareHandle
conf - The configuration for the query to execute
queryName - the query name
Returns:
Returns the query handle
Throws:
LensException - the lens exception

executePrepare

QueryHandleWithResultSet executePrepare(LensSessionHandle sessionHandle,
                                        QueryPrepareHandle prepareHandle,
                                        long timeoutmillis,
                                        LensConf conf,
                                        String queryName)
                                        throws LensException
Execute already prepared query with timeout. Query can be prepared with explain

Parameters:
sessionHandle - the session handle
prepareHandle - The QueryPrepareHandle
timeoutmillis - The timeout after which it will return handle, if query did not finish before.
conf - The configuration for the query to execute
queryName - the query name
Returns:
the query handle with result set
Throws:
LensException - the lens exception

executeAsync

QueryHandle executeAsync(LensSessionHandle sessionHandle,
                         String query,
                         LensConf conf,
                         String queryName)
                         throws LensException
Asynchronously execute the query.

Parameters:
sessionHandle - the session handle
query - The query should be in HiveQL(SQL like)
conf - The query configuration
queryName - the query name
Returns:
a query handle, which can used to know the status.
Throws:
LensException - the lens exception

updateQueryConf

boolean updateQueryConf(LensSessionHandle sessionHandle,
                        QueryHandle queryHandle,
                        LensConf newconf)
                        throws LensException
Update the query conf.

Parameters:
sessionHandle - the session handle
queryHandle - the query handle
newconf - the newconf
Returns:
true if update is successful
Throws:
LensException - the lens exception

execute

QueryHandleWithResultSet execute(LensSessionHandle sessionHandle,
                                 String query,
                                 long timeoutmillis,
                                 LensConf conf,
                                 String queryName)
                                 throws LensException
Execute the query with a timeout.

Parameters:
sessionHandle - the session handle
query - The query should be in HiveQL(SQL like)
timeoutmillis - The timeout after which it will return handle, if query did not finish before.
conf - The query configuration
queryName - the query name
Returns:
a query handle, if query did not finish within the timeout specified else result will also be returned.
Throws:
LensException - the lens exception

getQuery

LensQuery getQuery(LensSessionHandle sessionHandle,
                   QueryHandle queryHandle)
                   throws LensException
Get the query, specified by the handle.

Parameters:
sessionHandle - the session handle
queryHandle - The query handle
Returns:
query status
Throws:
LensException - the lens exception

getResultSetMetadata

QueryResultSetMetadata getResultSetMetadata(LensSessionHandle sessionHandle,
                                            QueryHandle queryHandle)
                                            throws LensException
Get the result set metadata - list of columns(names and types) and result size.

Parameters:
sessionHandle - the session handle
queryHandle - the query handle
Returns:
The result set metadata
Throws:
LensException - the lens exception

fetchResultSet

QueryResult fetchResultSet(LensSessionHandle sessionHandle,
                           QueryHandle queryHandle,
                           long startIndex,
                           int fetchSize)
                           throws LensException
Fetch the results of the query, specified by the handle.

Parameters:
sessionHandle - the session handle
queryHandle - The query handle
startIndex - The start Index from which result rows have to be fetched
fetchSize - Number of rows to be fetched
Returns:
returns the result set
Throws:
LensException - the lens exception

getHttpResultSet

javax.ws.rs.core.Response getHttpResultSet(LensSessionHandle sessionHandle,
                                           QueryHandle queryHandle)
                                           throws LensException
Get the http end point for the result set.

Parameters:
sessionHandle - The lens session handle
queryHandle - The query handle
Returns:
returns javax.ws.rs.core.Response object
Throws:
LensException - the lens exception

closeResultSet

void closeResultSet(LensSessionHandle sessionHandle,
                    QueryHandle queryHandle)
                    throws LensException
Closes result set by releasing any resources used in serving the resultset.

Parameters:
sessionHandle - the session handle
queryHandle - the query handle
Throws:
LensException - the lens exception

cancelQuery

boolean cancelQuery(LensSessionHandle sessionHandle,
                    QueryHandle queryHandle)
                    throws LensException
Cancel the execution of the query, specified by the handle.

Parameters:
sessionHandle - the session handle
queryHandle - The query handle.
Returns:
true if cancel was successful, false otherwise
Throws:
LensException - the lens exception

getAllQueries

List<QueryHandle> getAllQueries(LensSessionHandle sessionHandle,
                                String state,
                                String user,
                                String queryName,
                                long fromDate,
                                long toDate)
                                throws LensException
Returns all the queries in the specified state, for the given user and matching query name.

Parameters:
sessionHandle - the session handle
state - return queries in this state. if null, all queries will be returned
user - Get queries submitted by a specific user. If this set to "all", queries of all users are returned
queryName - return queries containing the query name. If null, all queries will be returned
fromDate - start date of time range interval
toDate - end date of the time range interval
Returns:
List of query handles
Throws:
LensException - the lens exception

getAllPreparedQueries

List<QueryPrepareHandle> getAllPreparedQueries(LensSessionHandle sessionHandle,
                                               String user,
                                               String queryName,
                                               long fromDate,
                                               long toDate)
                                               throws LensException
Returns all the prepared queries for the specified user. If no user is passed, queries of all users will be returned.

Parameters:
sessionHandle - the session handle
user - 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 name
fromDate - start time for filtering prepared queries by preparation time
toDate - end time for filtering prepared queries by preparation time
Returns:
List of query prepare handles
Throws:
LensException - the lens exception

destroyPrepared

boolean destroyPrepared(LensSessionHandle sessionHandle,
                        QueryPrepareHandle prepared)
                        throws LensException
Destroy a prepared query.

Parameters:
sessionHandle - the session handle
prepared - the prepared
Returns:
return true if successful, false otherwise
Throws:
LensException - the lens exception

getPreparedQuery

LensPreparedQuery getPreparedQuery(LensSessionHandle sessionHandle,
                                   QueryPrepareHandle prepareHandle)
                                   throws LensException
Get prepared query.

Parameters:
sessionHandle - the session handle
prepareHandle - the prepare handle
Returns:
PreparedQueryContext object
Throws:
LensException - the lens exception

updateQueryConf

boolean updateQueryConf(LensSessionHandle sessionHandle,
                        QueryPrepareHandle prepareHandle,
                        LensConf newconf)
                        throws LensException
Update configuration for prepared query.

Parameters:
sessionHandle - the session handle
prepareHandle - the prepare handle
newconf - the newconf
Returns:
true if update is successful, false otherwise
Throws:
LensException - the lens exception

getQueuedQueriesCount

long getQueuedQueriesCount()
Get queued queries count

Returns:
queued queries count

getRunningQueriesCount

long getRunningQueriesCount()
Get running queries count

Returns:
running queries count

getFinishedQueriesCount

long getFinishedQueriesCount()
Get finished queries count

Returns:
finished queries count


Copyright © 2014–2015 Apache Software Foundation. All rights reserved.