Package org.apache.drill.exec.ops
Interface FragmentContextInterface
public interface FragmentContextInterface
Fragment context interface: separates implementation from definition.
Allows unit testing by mocking or reimplementing services with
test-time versions. The name is awkward, chosen to avoid renaming
the implementation class which is used in many places in legacy code.
New code should use this interface, and the names should eventually
be swapped with FragmentContext becoming
FragmentContextImpl and this interface becoming
FragmentContext.
-
Method Summary
Modifier and TypeMethodDescriptionReturns the Drill configuration for this run.Drillbit context.Return the set of execution controls used to inject faults into running code for testing.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) Generates code for a class given aCodeGenerator
, and returns the specified number of instances of the generated class.getManagedBuffer
(int size) Returns the session options.newOperatorContext
(PhysicalOperator popConfig) newOperatorContext
(PhysicalOperator popConfig, OperatorStats stats) boolean
Determine if fragment execution has been interrupted.
-
Method Details
-
getDrillbitContext
DrillbitContext getDrillbitContext()Drillbit context. Valid only in production; returns null in operator test environments. -
getFunctionRegistry
FunctionImplementationRegistry getFunctionRegistry()Returns the UDF registry.- Returns:
- the UDF registry
-
getOptions
OptionManager getOptions()Returns the session options.- Returns:
- the session options
-
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
- Throws:
ClassTransformationException
IOException
-
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
- Throws:
ClassTransformationException
IOException
-
getImplementationClass
<T> List<T> getImplementationClass(ClassGenerator<T> cg, int instanceCount) throws ClassTransformationException, IOException 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
- Throws:
ClassTransformationException
IOException
-
getImplementationClass
<T> List<T> getImplementationClass(CodeGenerator<T> cg, int instanceCount) throws ClassTransformationException, IOException Generates code for a class given aCodeGenerator
, 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 code generator- Returns:
- list of instances of the generated class
- Throws:
ClassTransformationException
IOException
-
shouldContinue
boolean shouldContinue()Determine if fragment execution has been interrupted.- Returns:
- true if execution should continue, false if an interruption has occurred and fragment execution should halt
-
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
-
replace
-
getManagedBuffer
DrillBuf getManagedBuffer() -
getManagedBuffer
-
newOperatorContext
OperatorContext newOperatorContext(PhysicalOperator popConfig, OperatorStats stats) throws OutOfMemoryException - Throws:
OutOfMemoryException
-
newOperatorContext
- Throws:
OutOfMemoryException
-
getQueryUserName
String getQueryUserName()
-