org.apache.lens.client
Class LensStatement

java.lang.Object
  extended by org.apache.lens.client.LensStatement

public class LensStatement
extends Object

Top level class which is used to execute lens queries.


Constructor Summary
LensStatement(LensConnection connection)
          Instantiates a new lens statement.
 
Method Summary
 boolean closeResultSet()
          Close result set.
 boolean destroyPrepared(QueryPrepareHandle phandle)
          Destroy prepared.
 void execute(String sql, boolean waitForQueryToComplete, String queryName)
          Execute.
 void execute(String sql, String queryName)
          Execute.
 QueryHandle executeQuery(QueryPrepareHandle phandle, boolean waitForQueryToComplete, String queryName)
          Execute query.
 QueryHandle executeQuery(QueryPrepareHandle phandle, String queryName)
          Execute query.
 QueryHandle executeQuery(String sql, boolean waitForQueryToComplete, String queryName)
          Execute query.
 QueryPlan explainAndPrepare(String sql, String queryName)
          Explain and prepare.
 QueryPlan explainQuery(String sql)
          Explain query.
 List<QueryPrepareHandle> getAllPreparedQueries(String userName, String queryName, long fromDate, long toDate)
          Gets the all prepared queries.
 List<QueryHandle> getAllQueries(String state, String queryName, String user, long fromDate, long toDate)
          Gets the all queries.
 LensPreparedQuery getPreparedQuery(QueryPrepareHandle handle)
          Gets the prepared query.
 LensQuery getQuery()
           
 LensQuery getQuery(QueryHandle handle)
          Gets the query.
 QueryResult getResultSet()
           
 QueryResult getResultSet(LensQuery query)
          Gets the result set.
 QueryResultSetMetadata getResultSetMetaData()
           
 QueryResultSetMetadata getResultSetMetaData(LensQuery query)
          Gets the result set meta data.
 QueryStatus getStatus()
           
 boolean isIdle()
           
 boolean kill()
          Kill.
 boolean kill(LensQuery query)
          Kill.
 QueryPrepareHandle prepareQuery(String sql, String queryName)
          Prepare query.
 boolean wasQuerySuccessful()
          Was query successful.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LensStatement

public LensStatement(LensConnection connection)
Instantiates a new lens statement.

Parameters:
connection - the connection
Method Detail

execute

public void execute(String sql,
                    boolean waitForQueryToComplete,
                    String queryName)
Execute.

Parameters:
sql - the sql
waitForQueryToComplete - the wait for query to complete
queryName - the query name

execute

public void execute(String sql,
                    String queryName)
Execute.

Parameters:
sql - the sql
queryName - the query name

executeQuery

public QueryHandle executeQuery(String sql,
                                boolean waitForQueryToComplete,
                                String queryName)
Execute query.

Parameters:
sql - the sql
waitForQueryToComplete - the wait for query to complete
queryName - the query name
Returns:
the query handle

executeQuery

public QueryHandle executeQuery(QueryPrepareHandle phandle,
                                boolean waitForQueryToComplete,
                                String queryName)
Execute query.

Parameters:
phandle - the phandle
waitForQueryToComplete - the wait for query to complete
queryName - the query name
Returns:
the query handle

prepareQuery

public QueryPrepareHandle prepareQuery(String sql,
                                       String queryName)
Prepare query.

Parameters:
sql - the sql
queryName - the query name
Returns:
the query prepare handle

explainAndPrepare

public QueryPlan explainAndPrepare(String sql,
                                   String queryName)
Explain and prepare.

Parameters:
sql - the sql
queryName - the query name
Returns:
the query plan

getQuery

public LensQuery getQuery(QueryHandle handle)
Gets the query.

Parameters:
handle - the handle
Returns:
the query

getPreparedQuery

public LensPreparedQuery getPreparedQuery(QueryPrepareHandle handle)
Gets the prepared query.

Parameters:
handle - the handle
Returns:
the prepared query

executeQuery

public QueryHandle executeQuery(QueryPrepareHandle phandle,
                                String queryName)
Execute query.

Parameters:
phandle - the phandle
queryName - the query name
Returns:
the query handle

explainQuery

public QueryPlan explainQuery(String sql)
Explain query.

Parameters:
sql - the sql
Returns:
the query plan

getAllQueries

public List<QueryHandle> getAllQueries(String state,
                                       String queryName,
                                       String user,
                                       long fromDate,
                                       long toDate)
Gets the all queries.

Parameters:
state - the state
queryName - the query name
user - the user
fromDate - the from date
toDate - the to date
Returns:
the all queries

getAllPreparedQueries

public List<QueryPrepareHandle> getAllPreparedQueries(String userName,
                                                      String queryName,
                                                      long fromDate,
                                                      long toDate)
Gets the all prepared queries.

Parameters:
userName - the user name
queryName - the query name
fromDate - the from date
toDate - the to date
Returns:
the all prepared queries

getResultSetMetaData

public QueryResultSetMetadata getResultSetMetaData()

getResultSetMetaData

public QueryResultSetMetadata getResultSetMetaData(LensQuery query)
Gets the result set meta data.

Parameters:
query - the query
Returns:
the result set meta data

getResultSet

public QueryResult getResultSet()

getResultSet

public QueryResult getResultSet(LensQuery query)
Gets the result set.

Parameters:
query - the query
Returns:
the result set

kill

public boolean kill()
Kill.

Returns:
true, if successful

kill

public boolean kill(LensQuery query)
Kill.

Parameters:
query - the query
Returns:
true, if successful

closeResultSet

public boolean closeResultSet()
Close result set.

Returns:
true, if successful

destroyPrepared

public boolean destroyPrepared(QueryPrepareHandle phandle)
Destroy prepared.

Parameters:
phandle - the phandle
Returns:
true, if successful

isIdle

public boolean isIdle()

wasQuerySuccessful

public boolean wasQuerySuccessful()
Was query successful.

Returns:
true, if successful

getStatus

public QueryStatus getStatus()

getQuery

public LensQuery getQuery()


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