public class QueryContext extends Object implements AutoCloseable, OptimizerRulesContext, SchemaConfig.SchemaConfigInfoProvider
| Modifier and Type | Class and Description |
|---|---|
static class |
QueryContext.SqlStatementType |
INJECTABLE_GETTER_METHODS| Constructor and Description |
|---|
QueryContext(UserSession session,
DrillbitContext drillbitContext,
UserBitShared.QueryId queryId) |
| Modifier and Type | Method and Description |
|---|---|
void |
clearSQLStatementType()
Clears the type
QueryContext.SqlStatementType of the statement. |
void |
close() |
Collection<CoordinationProtos.DrillbitEndpoint> |
getActiveEndpoints() |
AliasRegistryProvider |
getAliasRegistryProvider() |
BufferAllocator |
getAllocator()
Method returns the allocator
|
DrillConfig |
getConfig() |
ValueHolder |
getConstantValueHolder(String value,
TypeProtos.MinorType type,
org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,ValueHolder> holderInitializer)
Works with value holders cache which holds constant value and its wrapper by type.
|
ContextInformation |
getContextInformation()
Get the context information such as:
- query start time
- root fragment timezone
- query userName
- system userName
- default schema name in current session at the time of query.
|
CoordinationProtos.DrillbitEndpoint |
getCurrentEndpoint() |
DrillOperatorTable |
getDrillOperatorTable() |
ExecutionControls |
getExecutionControls() |
FunctionImplementationRegistry |
getFunctionRegistry()
Method returns the function registry
|
LogicalPlanPersistence |
getLpPersistence() |
DrillBuf |
getManagedBuffer()
For UDFs to allocate general purpose intermediate buffers we provide the
DrillBuf type as an injectable, which provides access to an off-heap
buffer that can be tracked by Drill and re-allocated as needed.
|
MetastoreRegistry |
getMetastoreRegistry() |
org.apache.calcite.schema.SchemaPlus |
getNewDefaultSchema()
Return reference to default schema instance in a schema tree.
|
Collection<CoordinationProtos.DrillbitEndpoint> |
getOnlineEndpoints() |
OptionValue |
getOption(String optionKey) |
QueryOptionManager |
getOptions() |
PartitionExplorer |
getPartitionExplorer()
A partition explorer allows UDFs to view the sub-partitions below a
particular partition.
|
PlannerSettings |
getPlannerSettings()
Method returns the planner options
|
QueryProfileStoreContext |
getProfileStoreContext() |
BitControl.QueryContextInformation |
getQueryContextInfo() |
UserBitShared.QueryId |
getQueryId() |
String |
getQueryUserName()
Get the user name of the user who issued the query that is managed by this QueryContext.
|
RemoteFunctionRegistry |
getRemoteFunctionRegistry() |
org.apache.calcite.schema.SchemaPlus |
getRootSchema()
Get root schema with schema owner as the user who issued the query that is managed by this QueryContext.
|
org.apache.calcite.schema.SchemaPlus |
getRootSchema(SchemaConfig schemaConfig)
Create and return a
SchemaPlus with given schemaConfig but some schemas (from storage plugins)
could be initialized later. |
org.apache.calcite.schema.SchemaPlus |
getRootSchema(String userName)
Return root schema with schema owner as the given user.
|
UserSession |
getSession() |
QueryContext.SqlStatementType |
getSQLStatementType() |
StoragePluginRegistry |
getStorage() |
ViewExpansionContext |
getViewExpansionContext() |
boolean |
isImpersonationEnabled() |
boolean |
isRuntimeFilterEnabled() |
boolean |
isSkipProfileWrite() |
boolean |
isUserAuthenticationEnabled() |
void |
reloadDrillOperatorTable()
Re-creates drill operator table to refresh functions list from local function registry.
|
void |
setSQLStatementType(QueryContext.SqlStatementType stmtType) |
void |
skipWritingProfile(boolean skipWriting)
Skip writing profile
|
public QueryContext(UserSession session, DrillbitContext drillbitContext, UserBitShared.QueryId queryId)
public PlannerSettings getPlannerSettings()
OptimizerRulesContextgetPlannerSettings in interface OptimizerRulesContextpublic UserSession getSession()
public BufferAllocator getAllocator()
OptimizerRulesContextgetAllocator in interface OptimizerRulesContextpublic UserBitShared.QueryId getQueryId()
public org.apache.calcite.schema.SchemaPlus getNewDefaultSchema()
SchemaPlus
instance can refer to its parent and its children. From the returned reference to default schema instance,
clients can traverse the entire schema tree and know the default schema where to look up the tables first.public org.apache.calcite.schema.SchemaPlus getRootSchema()
public org.apache.calcite.schema.SchemaPlus getRootSchema(String userName)
getRootSchema in interface SchemaConfig.SchemaConfigInfoProvideruserName - User who owns the schema tree.public org.apache.calcite.schema.SchemaPlus getRootSchema(SchemaConfig schemaConfig)
SchemaPlus with given schemaConfig but some schemas (from storage plugins)
could be initialized later.schemaConfig - SchemaPlus with given schemaConfig.public String getQueryUserName()
getQueryUserName in interface SchemaConfig.SchemaConfigInfoProviderpublic QueryOptionManager getOptions()
public ExecutionControls getExecutionControls()
public CoordinationProtos.DrillbitEndpoint getCurrentEndpoint()
public StoragePluginRegistry getStorage()
public LogicalPlanPersistence getLpPersistence()
public Collection<CoordinationProtos.DrillbitEndpoint> getActiveEndpoints()
public Collection<CoordinationProtos.DrillbitEndpoint> getOnlineEndpoints()
public DrillConfig getConfig()
public QueryProfileStoreContext getProfileStoreContext()
public FunctionImplementationRegistry getFunctionRegistry()
OptimizerRulesContextgetFunctionRegistry in interface OptimizerRulesContextpublic ViewExpansionContext getViewExpansionContext()
getViewExpansionContext in interface SchemaConfig.SchemaConfigInfoProviderpublic OptionValue getOption(String optionKey)
getOption in interface SchemaConfig.SchemaConfigInfoProviderpublic boolean isImpersonationEnabled()
public boolean isUserAuthenticationEnabled()
public boolean isRuntimeFilterEnabled()
public DrillOperatorTable getDrillOperatorTable()
public void reloadDrillOperatorTable()
public BitControl.QueryContextInformation getQueryContextInfo()
public RemoteFunctionRegistry getRemoteFunctionRegistry()
public ContextInformation getContextInformation()
UdfUtilitiesgetContextInformation in interface UdfUtilitiespublic DrillBuf getManagedBuffer()
UdfUtilitiesgetManagedBuffer in interface UdfUtilitiespublic PartitionExplorer getPartitionExplorer()
UdfUtilitiesDirectoryExplorers for
example usages of this interface.getPartitionExplorer in interface UdfUtilitiespublic ValueHolder getConstantValueHolder(String value, TypeProtos.MinorType type, org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,ValueHolder> holderInitializer)
UdfUtilitiesgetConstantValueHolder in interface UdfUtilitiespublic void close()
throws Exception
close in interface AutoCloseableExceptionpublic void setSQLStatementType(QueryContext.SqlStatementType stmtType)
stmtType - : Sets the type QueryContext.SqlStatementType of the statement e.g. CTAS, ANALYZEpublic void clearSQLStatementType()
QueryContext.SqlStatementType of the statement.public QueryContext.SqlStatementType getSQLStatementType()
QueryContext.SqlStatementType of the statement e.g. CTAS, ANALYZEpublic void skipWritingProfile(boolean skipWriting)
skipWriting - public boolean isSkipProfileWrite()
public MetastoreRegistry getMetastoreRegistry()
public AliasRegistryProvider getAliasRegistryProvider()
Copyright © 2022 The Apache Software Foundation. All rights reserved.