Package org.apache.drill.exec.ops
Class QueryContext
java.lang.Object
org.apache.drill.exec.ops.QueryContext
- All Implemented Interfaces:
AutoCloseable,OptimizerRulesContext,UdfUtilities,SchemaConfig.SchemaConfigInfoProvider
public class QueryContext
extends Object
implements AutoCloseable, OptimizerRulesContext, SchemaConfig.SchemaConfigInfoProvider
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface org.apache.drill.exec.ops.UdfUtilities
INJECTABLE_GETTER_METHODS -
Constructor Summary
ConstructorsConstructorDescriptionQueryContext(UserSession session, DrillbitContext drillbitContext, UserBitShared.QueryId queryId) -
Method Summary
Modifier and TypeMethodDescriptionvoidClears the typeQueryContext.SqlStatementTypeof the statement.voidclose()Method returns the allocatorgetConstantValueHolder(String value, TypeProtos.MinorType type, com.google.common.base.Function<DrillBuf, ValueHolder> holderInitializer) Works with value holders cache which holds constant value and its wrapper by type.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.The Drillbit context allows UDFs to view storage information and other pieces of information about the running system.Method returns the function registryFor 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.org.apache.calcite.schema.SchemaPlusReturn reference to default schema instance in a schema tree.A partition explorer allows UDFs to view the sub-partitions below a particular partition.Method returns the planner optionsGet the user name of the user who issued the query that is managed by this QueryContext.org.apache.calcite.schema.SchemaPlusGet root schema with schema owner as the user who issued the query that is managed by this QueryContext.org.apache.calcite.schema.SchemaPlusgetRootSchema(String userName) Return root schema with schema owner as the given user.org.apache.calcite.schema.SchemaPlusgetRootSchema(SchemaConfig schemaConfig) Create and return aSchemaPluswith given schemaConfig but some schemas (from storage plugins) could be initialized later.getTemporaryTableName(String table) booleanbooleanbooleanbooleanvoidRe-creates drill operator table to refresh functions list from local function registry.voidvoidskipWritingProfile(boolean skipWriting) Skip writing profile
-
Constructor Details
-
Method Details
-
getPlannerSettings
Description copied from interface:OptimizerRulesContextMethod returns the planner options- Specified by:
getPlannerSettingsin interfaceOptimizerRulesContext- Returns:
- PlannerSettings
-
getQueryUserCredentials
- Specified by:
getQueryUserCredentialsin interfaceSchemaConfig.SchemaConfigInfoProvider
-
getAllocator
Description copied from interface:OptimizerRulesContextMethod returns the allocator- Specified by:
getAllocatorin interfaceOptimizerRulesContext- Returns:
- BufferAllocator
-
getSession
-
getQueryId
-
getNewDefaultSchema
public org.apache.calcite.schema.SchemaPlus getNewDefaultSchema()Return reference to default schema instance in a schema tree. EachSchemaPlusinstance 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.- Returns:
- Reference to default schema instance in a schema tree.
-
getRootSchema
public 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.- Returns:
- Root of the schema tree.
-
getRootSchema
Return root schema with schema owner as the given user.- Specified by:
getRootSchemain interfaceSchemaConfig.SchemaConfigInfoProvider- Parameters:
userName- User who owns the schema tree.- Returns:
- Root of the schema tree.
-
getRootSchema
Create and return aSchemaPluswith given schemaConfig but some schemas (from storage plugins) could be initialized later.- Parameters:
schemaConfig-- Returns:
- A
SchemaPluswith given schemaConfig.
-
getQueryUserName
Get the user name of the user who issued the query that is managed by this QueryContext.- Specified by:
getQueryUserNamein interfaceSchemaConfig.SchemaConfigInfoProvider- Returns:
- The user name of the user who issued the query that is managed by this QueryContext.
-
getOptions
-
getExecutionControls
-
getCurrentEndpoint
-
getStorage
-
getLpPersistence
-
getActiveEndpoints
-
getOnlineEndpoints
-
getConfig
-
getProfileStoreContext
-
getFunctionRegistry
Description copied from interface:OptimizerRulesContextMethod returns the function registry- Specified by:
getFunctionRegistryin interfaceOptimizerRulesContext- Returns:
- FunctionImplementationRegistry
-
getViewExpansionContext
- Specified by:
getViewExpansionContextin interfaceSchemaConfig.SchemaConfigInfoProvider
-
getOption
- Specified by:
getOptionin interfaceSchemaConfig.SchemaConfigInfoProvider
-
getTemporaryTableName
- Specified by:
getTemporaryTableNamein interfaceSchemaConfig.SchemaConfigInfoProvider
-
getTemporaryWorkspace
- Specified by:
getTemporaryWorkspacein interfaceSchemaConfig.SchemaConfigInfoProvider
-
isImpersonationEnabled
public boolean isImpersonationEnabled() -
isUserAuthenticationEnabled
public boolean isUserAuthenticationEnabled() -
isRuntimeFilterEnabled
public boolean isRuntimeFilterEnabled() -
getDrillOperatorTable
-
reloadDrillOperatorTable
public void reloadDrillOperatorTable()Re-creates drill operator table to refresh functions list from local function registry. -
getQueryContextInfo
-
getRemoteFunctionRegistry
-
getContextInformation
Description copied from interface:UdfUtilitiesGet 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.- Specified by:
getContextInformationin interfaceUdfUtilities- Returns:
- - ContextInformation
-
getManagedBuffer
Description copied from interface:UdfUtilitiesFor 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.- Specified by:
getManagedBufferin interfaceUdfUtilities- Returns:
- - a buffer managed by Drill, connected to the fragment allocator for memory management
-
getDrillbitContext
Description copied from interface:UdfUtilitiesThe Drillbit context allows UDFs to view storage information and other pieces of information about the running system. See the http_get implementation for details.- Specified by:
getDrillbitContextin interfaceUdfUtilities- Returns:
- - an object for accessing drillbit information such as storage configs.
-
getResultSetLoader
- Specified by:
getResultSetLoaderin interfaceUdfUtilities
-
getPartitionExplorer
Description copied from interface:UdfUtilitiesA partition explorer allows UDFs to view the sub-partitions below a particular partition. This allows for the implementation of UDFs to query against the partition information, without having to read the actual data contained in the partition. This interface is designed for UDFs that take only constant inputs, as this interface will only be useful if we can evaluate the constant UDF at planning time. Any function defined to use this interface that is not evaluated at planning time by the constant folding rule will be querying the storage plugin for meta-data for each record processed. Be sure to check the query plans to see that this expression has already been evaluated during planning if you write UDFs against this interface. SeeDirectoryExplorersfor example usages of this interface.- Specified by:
getPartitionExplorerin interfaceUdfUtilities- Returns:
- - an object for exploring partitions of all available schemas
-
getConstantValueHolder
public ValueHolder getConstantValueHolder(String value, TypeProtos.MinorType type, com.google.common.base.Function<DrillBuf, ValueHolder> holderInitializer) Description copied from interface:UdfUtilitiesWorks with value holders cache which holds constant value and its wrapper by type. If value is absent uses holderInitializer to create holder and adds it to cache.- Specified by:
getConstantValueHolderin interfaceUdfUtilities- Returns:
- - a wrapper object for an constant value.
-
close
- Specified by:
closein interfaceAutoCloseable- Throws:
Exception
-
setSQLStatementType
- Parameters:
stmtType- : Sets the typeQueryContext.SqlStatementTypeof the statement e.g. CTAS, ANALYZE
-
clearSQLStatementType
public void clearSQLStatementType()Clears the typeQueryContext.SqlStatementTypeof the statement. -
getSQLStatementType
- Returns:
- Get the type
QueryContext.SqlStatementTypeof the statement e.g. CTAS, ANALYZE
-
skipWritingProfile
public void skipWritingProfile(boolean skipWriting) Skip writing profile- Parameters:
skipWriting-
-
isSkipProfileWrite
public boolean isSkipProfileWrite()- Returns:
- Check if to skip writing
-
getMetastoreRegistry
-
getAliasRegistryProvider
-