public class HiveDriver extends AbstractLensDriver
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_EXPIRY_DELAY |
static String |
HIVE_CONNECTION_CLASS
The Constant HIVE_CONNECTION_CLASS.
|
static String |
HIVE_QUERY_HOOK_CLASS |
static String |
HS2_CALCULATE_PRIORITY |
static String |
HS2_CONNECTION_EXPIRY_DELAY
The Constant HS2_CONNECTION_EXPIRY_DELAY.
|
static String |
HS2_COST_CALCULATOR |
static String |
HS2_PRIORITY_DEFAULT_RANGES |
static String |
HS2_PRIORITY_RANGES
Config param for defining priority ranges.
|
static String |
QUERY_LAUNCHING_CONSTRAINT_FACTORIES_KEY |
static String |
SESSION_KEY_DELIMITER |
Constructor and Description |
---|
HiveDriver()
Instantiates a new hive driver.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areDBResourcesAddedForSession(String sessionHandle,
String database)
Return true if resources have been added to this Hive session
|
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 |
closeSession(LensSessionHandle sessionHandle)
Close session.
|
void |
configure(org.apache.hadoop.conf.Configuration conf,
String driverType,
String driverName)
Configure driver with
Configuration passed. |
Priority |
decidePriority(AbstractQueryContext ctx)
decide priority based on query's cost.
|
QueryCost |
estimate(AbstractQueryContext qctx)
Estimate the cost of execution for given query.
|
LensResultSet |
execute(QueryContext ctx)
Blocking execute of the query
|
void |
executeAsync(QueryContext ctx)
Asynchronously execute the query.
|
HiveQueryPlan |
explain(AbstractQueryContext explainCtx)
Explain the given query.
|
DriverQueryPlan |
explainAndPrepare(PreparedQueryContext pContext)
Explain and prepare the given query.
|
org.apache.hadoop.conf.Configuration |
getConf()
Get driver configuration
|
Map<QueryHandle,org.apache.hive.service.cli.OperationHandle> |
getHiveHandles()
The hive handles.
|
com.google.common.collect.ImmutableSet<QueryLaunchingConstraint> |
getQueryConstraints() |
DriverQueryHook |
getQueryHook() |
com.google.common.collect.ImmutableSet<WaitingQueriesSelectionPolicy> |
getWaitingQuerySelectionPolicies() |
boolean |
hasLensSession(LensSessionHandle session)
Checks for lens session.
|
void |
prepare(PreparedQueryContext pContext)
Prepare the given query.
|
void |
readExternal(ObjectInput in) |
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 |
setResourcesAddedForSession(String sessionHandle,
String database)
Tell Hive driver that resources have been added for this session and for the given database
|
void |
updateStatus(QueryContext context)
Update driver query status in the context object.
|
void |
writeExternal(ObjectOutput out) |
fetchResultSet, getFullyQualifiedName, toString
public static final String HIVE_CONNECTION_CLASS
public static final String HIVE_QUERY_HOOK_CLASS
public static final String HS2_CONNECTION_EXPIRY_DELAY
public static final String HS2_CALCULATE_PRIORITY
public static final String HS2_COST_CALCULATOR
public static final String HS2_PRIORITY_RANGES
public static final long DEFAULT_EXPIRY_DELAY
public static final String HS2_PRIORITY_DEFAULT_RANGES
public static final String SESSION_KEY_DELIMITER
public static final String QUERY_LAUNCHING_CONSTRAINT_FACTORIES_KEY
public HiveDriver() throws LensException
LensException
- the lens exceptionpublic boolean areDBResourcesAddedForSession(String sessionHandle, String database)
sessionHandle
- lens session identifierdatabase
- lens databasepublic void setResourcesAddedForSession(String sessionHandle, String database)
sessionHandle
- lens session identifierdatabase
- lens databasepublic org.apache.hadoop.conf.Configuration getConf()
LensDriver
public void configure(org.apache.hadoop.conf.Configuration conf, String driverType, String driverName) throws LensException
LensDriver
Configuration
passed.configure
in interface LensDriver
configure
in class AbstractLensDriver
conf
- The configuration objectdriverType
- Type of the driver (Example: hive, jdbc, el)driverName
- Name of this driverLensException
- the lens exceptionpublic QueryCost estimate(AbstractQueryContext qctx) throws LensException
LensDriver
qctx
- The query contextLensException
- the lens exception if driver cannot estimatepublic HiveQueryPlan explain(AbstractQueryContext explainCtx) throws LensException
LensDriver
explainCtx
- The explain contextLensException
- the lens exceptionpublic DriverQueryPlan explainAndPrepare(PreparedQueryContext pContext) throws LensException
LensDriver
pContext
- the contextLensException
- the lens exceptionpublic void prepare(PreparedQueryContext pContext) throws LensException
LensDriver
pContext
- the contextLensException
- the lens exceptionpublic void closePreparedQuery(QueryPrepareHandle handle) throws LensException
LensDriver
handle
- The query handleLensException
- the lens exceptionpublic LensResultSet execute(QueryContext ctx) throws LensException
LensDriver
ctx
- the contextLensException
- the lens exceptionpublic void executeAsync(QueryContext ctx) throws LensException
LensDriver
ctx
- The query contextLensException
- the lens exceptionpublic void updateStatus(QueryContext context) throws LensException
LensDriver
context
- The query contextLensException
- the lens exceptionpublic void closeResultSet(QueryHandle handle) throws LensException
LensDriver
handle
- The query handleLensException
- the lens exceptionpublic void closeQuery(QueryHandle handle) throws LensException
LensDriver
handle
- The query handleLensException
- the lens exceptionpublic boolean cancelQuery(QueryHandle handle) throws LensException
LensDriver
handle
- The query handle.LensException
- the lens exceptionpublic void close()
LensDriver
public void registerDriverEventListener(LensEventListener<DriverEvent> driverEventListener)
driverEventListener
- the driver event listenerpublic com.google.common.collect.ImmutableSet<WaitingQueriesSelectionPolicy> getWaitingQuerySelectionPolicies()
WaitingQueriesSelectionPolicy
s to be used to select waiting queries eligible to be moved out
of waiting state. If there are no driver level waiting query selection policies, then an empty set is returned.
null is never returned.public Priority decidePriority(AbstractQueryContext ctx)
LensDriver
decidePriority
in interface LensDriver
decidePriority
in class AbstractLensDriver
that handles this on-demand computation.
public void registerForCompletionNotification(QueryHandle handle, long timeoutMillis, QueryCompletionListener listener) throws LensException
LensDriver
handle
- the handletimeoutMillis
- the timeout millislistener
- the listenerLensException
- the lens exceptionpublic void readExternal(ObjectInput in) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public void writeExternal(ObjectOutput out) throws IOException
IOException
public void closeSession(LensSessionHandle sessionHandle)
sessionHandle
- the session handlepublic boolean hasLensSession(LensSessionHandle session)
session
- the sessionpublic DriverQueryHook getQueryHook()
getQueryHook
in interface LensDriver
getQueryHook
in class AbstractLensDriver
for more details.
@Generated(value="lombok") public Map<QueryHandle,org.apache.hive.service.cli.OperationHandle> getHiveHandles()
@Generated(value="lombok") public com.google.common.collect.ImmutableSet<QueryLaunchingConstraint> getQueryConstraints()
QueryLaunchingConstraint
s to be checked before launching a query on driver. If there are no
driver level constraints, then an empty set is returned. null is never returned.Copyright © 2014–2016 Apache Software Foundation. All rights reserved.