Interface FragmentContext

All Superinterfaces:
AutoCloseable, UdfUtilities
All Known Subinterfaces:
ExchangeFragmentContext, ExecutorFragmentContext, RootFragmentContext
All Known Implementing Classes:
BaseFragmentContext, FragmentContextImpl

public interface FragmentContext extends UdfUtilities, AutoCloseable
Provides the resources required by a non-exchange operator to execute.
  • 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

      <T> T getImplementationClass(ClassGenerator<T> cg)
      Generates code for a class given a ClassGenerator, 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

      <T> T getImplementationClass(CodeGenerator<T> cg)
      Generates code for a class given a CodeGenerator, 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

      <T> List<T> getImplementationClass(ClassGenerator<T> cg, int instanceCount)
      Generates code for a class given a ClassGenerator, 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

      <T> List<T> getImplementationClass(CodeGenerator<T> cg, int instanceCount)
      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

    • 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

      OperatorContext newOperatorContext(PhysicalOperator popConfig)
    • newOperatorContext

      OperatorContext newOperatorContext(PhysicalOperator popConfig, OperatorStats stats)
    • getFullRootSchema

      org.apache.calcite.schema.SchemaPlus getFullRootSchema()
    • getQueryUserName

      String getQueryUserName()
    • getFragIdString

      String getFragIdString()
    • replace

      DrillBuf replace(DrillBuf old, int newSize)
    • 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 interface UdfUtilities
      Returns:
      - a buffer managed by Drill, connected to the fragment allocator for memory management
    • getManagedBuffer

      DrillBuf getManagedBuffer(int size)
    • getManagedBufferManager

      BufferManager getManagedBufferManager()
    • close

      void close()
      Specified by:
      close in interface AutoCloseable
    • addRuntimeFilter

      void addRuntimeFilter(RuntimeFilterWritable runtimeFilter)
      Add a RuntimeFilter when the RuntimeFilter receiver belongs to the same MinorFragment.
      Parameters:
      runtimeFilter - runtime filter
    • getRuntimeFilter

      RuntimeFilterWritable getRuntimeFilter(long rfIdentifier)
    • getRuntimeFilter

      RuntimeFilterWritable getRuntimeFilter(long rfIdentifier, long maxWaitTime, TimeUnit timeUnit)
      Get the RuntimeFilter with a blocking wait, if the waiting option is enabled.
      Parameters:
      rfIdentifier - runtime filter identifier
      maxWaitTime - max wait time
      timeUnit - 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

      void requestMemory(RecordBatch requestor)
      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 an OutOfMemoryException.