public interface DriverQueryHook
LensDriver.getQueryHook(). Lens Server will invoke the driver hook at relevant points during
query execution. By default each driver exposes a NoOpDriverQueryHook which does nothing when invoked.
The only use case I see right now is to provide a hook just after driver has been selected for a query and
before query is launched on the driver. One example usage for hive driver would be to add dynamic configuration or
stall execution of a query by looking at the final translated query itself (based on table involved, filters
involved, etc in the query).
This interface is expected to evolve for some time as more needs for hook are discovered
Note: Note if the hook updates any configuration, same should be reflected in QueryContext
via AbstractQueryContext.updateConf(java.util.Map) to ensure the modified configuration is persisted and
is available on server restarts and other bookkeeping needs.| Modifier and Type | Method and Description |
|---|---|
void |
postDriverSelection(AbstractQueryContext ctx)
Called just after driver has been selected to execute a query.
|
void |
postEstimate(AbstractQueryContext ctx)
Called just after a successful estimate operation is tried on this driver
|
void |
postRewrite(AbstractQueryContext ctx)
Called just after a successful rewrite operation is tried on this driver
|
void |
preEstimate(AbstractQueryContext ctx)
Called just before estimate operation is tried on this driver
Note : Estimate operation will be skipped if rewrite operation fails for this driver
|
void |
preLaunch(QueryContext ctx)
Called just before launching the query on the selected driver.
|
void |
preRewrite(AbstractQueryContext ctx)
Called just before rewrite operation is tried on this driver
|
void |
setDriver(LensDriver driver)
This setter method is called by the driver once hook instance is created.
|
void setDriver(LensDriver driver)
driver - void preRewrite(AbstractQueryContext ctx) throws LensException
ctx - LensExceptionvoid postRewrite(AbstractQueryContext ctx) throws LensException
ctx - LensExceptionvoid preEstimate(AbstractQueryContext ctx) throws LensException
ctx - LensExceptionvoid postEstimate(AbstractQueryContext ctx) throws LensException
ctx - LensExceptionvoid postDriverSelection(AbstractQueryContext ctx) throws LensException
ctx - LensExceptionvoid preLaunch(QueryContext ctx) throws LensException
ctx - LensExceptionCopyright © 2014–2018 Apache Software Foundation. All rights reserved.