org.apache.lens.server.api.driver
Interface LensDriver

All Superinterfaces:
Externalizable, Serializable
All Known Implementing Classes:
HiveDriver, JDBCDriver

public interface LensDriver
extends Externalizable

The Interface LensDriver.


Method Summary
 boolean cancelQuery(QueryHandle handle)
          Cancel the execution of the query, specified by the handle.
 void close()
          Close the driver, releasing all resouces used up by the driver.
 void closePreparedQuery(QueryPrepareHandle handle)
          Close the prepare query specified by the prepared handle, releases all the resources held by the prepared query.
 void closeQuery(QueryHandle handle)
          Close the query specified by the handle, releases all the resources held by the query.
 void closeResultSet(QueryHandle handle)
          Close the resultset for the query.
 void configure(org.apache.hadoop.conf.Configuration conf)
          Configure driver with Configuration passed.
 QueryCost estimate(AbstractQueryContext qctx)
          Estimate the cost of execution for given query.
 LensResultSet execute(QueryContext context)
          Blocking execute of the query

The driver would be closing the driver handle, once the results are fetched.

 void executeAsync(QueryContext context)
          Asynchronously execute the query.
 DriverQueryPlan explain(AbstractQueryContext explainCtx)
          Explain the given query.
 DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext)
          Explain and prepare the given query.
 LensResultSet fetchResultSet(QueryContext context)
          Fetch the results of the query, specified by the handle.
 org.apache.hadoop.conf.Configuration getConf()
          Get driver configuration
 void prepare(PreparedQueryContext pContext)
          Prepare the given query.
 void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener)
          Add a listener for driver events.
 void registerForCompletionNotification(QueryHandle handle, long timeoutMillis, QueryCompletionListener listener)
          Register for query completion notification.
 void updateStatus(QueryContext context)
          Update driver query status in the context object.
 
Methods inherited from interface java.io.Externalizable
readExternal, writeExternal
 

Method Detail

getConf

org.apache.hadoop.conf.Configuration getConf()
Get driver configuration


configure

void configure(org.apache.hadoop.conf.Configuration conf)
               throws LensException
Configure driver with Configuration passed.

Parameters:
conf - The configuration object
Throws:
LensException - the lens exception

estimate

QueryCost estimate(AbstractQueryContext qctx)
                   throws LensException
Estimate the cost of execution for given query. This should be returned with very less latency - should return within 10s of milli seconds.

Parameters:
qctx - The query context
Returns:
The QueryCost object
Throws:
LensException - the lens exception if driver cannot estimate

explain

DriverQueryPlan explain(AbstractQueryContext explainCtx)
                        throws LensException
Explain the given query.

Parameters:
explainCtx - The explain context
Returns:
The query plan object
Throws:
LensException - the lens exception

prepare

void prepare(PreparedQueryContext pContext)
             throws LensException
Prepare the given query.

Parameters:
pContext - the context
Throws:
LensException - the lens exception

explainAndPrepare

DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext)
                                  throws LensException
Explain and prepare the given query.

Parameters:
pContext - the context
Returns:
The query plan object;
Throws:
LensException - the lens exception

closePreparedQuery

void closePreparedQuery(QueryPrepareHandle handle)
                        throws LensException
Close the prepare query specified by the prepared handle, releases all the resources held by the prepared query.

Parameters:
handle - The query handle
Throws:
LensException - the lens exception

execute

LensResultSet execute(QueryContext context)
                      throws LensException
Blocking execute of the query

The driver would be closing the driver handle, once the results are fetched.

Parameters:
context - the context
Returns:
returns the result set, null if there is no result available
Throws:
LensException - the lens exception

executeAsync

void executeAsync(QueryContext context)
                  throws LensException
Asynchronously execute the query.

Parameters:
context - The query context
Throws:
LensException - the lens exception

registerForCompletionNotification

void registerForCompletionNotification(QueryHandle handle,
                                       long timeoutMillis,
                                       QueryCompletionListener listener)
                                       throws LensException
Register for query completion notification.

Parameters:
handle - the handle
timeoutMillis - the timeout millis
listener - the listener
Throws:
LensException - the lens exception

updateStatus

void updateStatus(QueryContext context)
                  throws LensException
Update driver query status in the context object.

Parameters:
context - The query context
Throws:
LensException - the lens exception

fetchResultSet

LensResultSet fetchResultSet(QueryContext context)
                             throws LensException
Fetch the results of the query, specified by the handle.

Parameters:
context - The query context
Returns:
returns the result set
Throws:
LensException - the lens exception

closeResultSet

void closeResultSet(QueryHandle handle)
                    throws LensException
Close the resultset for the query.

Parameters:
handle - The query handle
Throws:
LensException - the lens exception

cancelQuery

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

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

closeQuery

void closeQuery(QueryHandle handle)
                throws LensException
Close the query specified by the handle, releases all the resources held by the query.

Parameters:
handle - The query handle
Throws:
LensException - the lens exception

close

void close()
           throws LensException
Close the driver, releasing all resouces used up by the driver.

Throws:
LensException - the lens exception

registerDriverEventListener

void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener)
Add a listener for driver events.

Parameters:
driverEventListener - the driver event listener


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