Package org.apache.drill.exec.ops
Interface FragmentContext
- All Superinterfaces:
AutoCloseable
,UdfUtilities
- All Known Subinterfaces:
ExchangeFragmentContext
,ExecutorFragmentContext
,RootFragmentContext
- All Known Implementing Classes:
BaseFragmentContext
,FragmentContextImpl
Provides the resources required by a non-exchange operator to execute.
-
Nested Class Summary
-
Field Summary
Fields inherited from interface org.apache.drill.exec.ops.UdfUtilities
INJECTABLE_GETTER_METHODS
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRuntimeFilter
(RuntimeFilterWritable runtimeFilter) Add a RuntimeFilter when the RuntimeFilter receiver belongs to the same MinorFragment.void
close()
Get an instance of alias registry provider for obtaining aliases.Returns the Drill configuration for this run.Return the set of execution controls used to inject faults into running code for testing.org.apache.calcite.schema.SchemaPlus
Returns the UDF registry.<T> T
Generates code for a class given aClassGenerator
, and returns a single instance of the generated class.<T> List<T>
getImplementationClass
(ClassGenerator<T> cg, int instanceCount) Generates code for a class given aClassGenerator
, and returns the specified number of instances of the generated class.<T> T
Generates code for a class given aCodeGenerator
, and returns a single instance of the generated class.<T> List<T>
getImplementationClass
(CodeGenerator<T> cg, int instanceCount) Get this node's identity.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.getManagedBuffer
(int size) Get instance of Metastore registry to obtain Metastore instance if needed.getNewChildAllocator
(String operatorName, int operatorId, long initialReservation, long maximumReservation) Returns a read-only version of the session options.getRuntimeFilter
(long rfIdentifier) getRuntimeFilter
(long rfIdentifier, long maxWaitTime, TimeUnit timeUnit) Get the RuntimeFilter with a blocking wait, if the waiting option is enabled.Returns the statement type (e.g.boolean
newOperatorContext
(PhysicalOperator popConfig) newOperatorContext
(PhysicalOperator popConfig, OperatorStats stats) void
requestMemory
(RecordBatch requestor) An operator is experiencing memory pressure.Methods inherited from interface org.apache.drill.exec.ops.UdfUtilities
getConstantValueHolder, getContextInformation, getDrillbitContext, getPartitionExplorer, getResultSetLoader
-
Method Details
-
getFunctionRegistry
FunctionLookupContext getFunctionRegistry()Returns the UDF registry.- Returns:
- the UDF registry
-
getOptions
OptionManager getOptions()Returns a read-only version of the session options.- Returns:
- the session options
-
isImpersonationEnabled
boolean isImpersonationEnabled() -
getImplementationClass
Generates code for a class given aClassGenerator
, and returns a single instance of the generated class. (Note that the name is a misnomer, it would be better called getImplementationInstance.)- Parameters:
cg
- the class generator- Returns:
- an instance of the generated class
-
getImplementationClass
Generates code for a class given aCodeGenerator
, and returns a single instance of the generated class. (Note that the name is a misnomer, it would be better called getImplementationInstance.)- Parameters:
cg
- the code generator- Returns:
- an instance of the generated class
-
getImplementationClass
Generates code for a class given aClassGenerator
, and returns the specified number of instances of the generated class. (Note that the name is a misnomer, it would be better called getImplementationInstances.)- Parameters:
cg
- the class generator- Returns:
- list of instances of the generated class
-
getSQLStatementType
QueryContext.SqlStatementType getSQLStatementType()Returns the statement type (e.g. SELECT, CTAS, ANALYZE) from the query context.- Returns:
- query statement type
QueryContext.SqlStatementType
, if known.
-
getImplementationClass
Get this node's identity.- Returns:
- A DrillbitEndpoint object.
-
getExecutionControls
ExecutionControls getExecutionControls()Return the set of execution controls used to inject faults into running code for testing.- Returns:
- the execution controls
-
getConfig
DrillConfig getConfig()Returns the Drill configuration for this run. Note that the config is global and immutable.- Returns:
- the Drill configuration
-
getCompiler
CodeCompiler getCompiler() -
getScanDecodeExecutor
ExecutorService getScanDecodeExecutor() -
getScanExecutor
ExecutorService getScanExecutor() -
getExecutor
ExecutorService getExecutor() -
getExecutorState
FragmentContext.ExecutorState getExecutorState() -
getNewChildAllocator
BufferAllocator getNewChildAllocator(String operatorName, int operatorId, long initialReservation, long maximumReservation) -
getHandle
ExecProtos.FragmentHandle getHandle() -
getAllocator
BufferAllocator getAllocator() -
getQueryId
UserBitShared.QueryId getQueryId()- Returns:
- ID
UUID
of the current query
-
getQueryIdString
String getQueryIdString()- Returns:
- The string representation of the ID
UUID
of the current query
-
newOperatorContext
-
newOperatorContext
-
getFullRootSchema
org.apache.calcite.schema.SchemaPlus getFullRootSchema() -
getQueryUserName
String getQueryUserName() -
getFragIdString
String getFragIdString() -
replace
-
getManagedBuffer
DrillBuf getManagedBuffer()Description copied from interface:UdfUtilities
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.- Specified by:
getManagedBuffer
in interfaceUdfUtilities
- Returns:
- - a buffer managed by Drill, connected to the fragment allocator for memory management
-
getManagedBuffer
-
getManagedBufferManager
BufferManager getManagedBufferManager() -
close
void close()- Specified by:
close
in interfaceAutoCloseable
-
addRuntimeFilter
Add a RuntimeFilter when the RuntimeFilter receiver belongs to the same MinorFragment.- Parameters:
runtimeFilter
- runtime filter
-
getRuntimeFilter
-
getRuntimeFilter
Get the RuntimeFilter with a blocking wait, if the waiting option is enabled.- Parameters:
rfIdentifier
- runtime filter identifiermaxWaitTime
- max wait timetimeUnit
- time unit- Returns:
- the RFW or null
-
getMetastoreRegistry
MetastoreRegistry getMetastoreRegistry()Get instance of Metastore registry to obtain Metastore instance if needed.- Returns:
- Metastore registry
-
getAliasRegistryProvider
AliasRegistryProvider getAliasRegistryProvider()Get an instance of alias registry provider for obtaining aliases.- Returns:
- alias registry provider
-
requestMemory
An operator is experiencing memory pressure. Asks the fragment executor to poll all operators to release an optional memory (such as by spilling.) The request is advisory. The caller should again try to allocate memory, and if the second request fails, throw anOutOfMemoryException
.
-