public class FragmentContextImpl extends BaseFragmentContext implements ExecutorFragmentContext
FragmentContext
: A context provided to non-exchange
operators.ExchangeFragmentContext
: A context provided to exchange
operators.RootFragmentContext
: A context provided to fragment roots.ExecutorFragmentContext
: A context used by the Drillbit.FragmentContext
) to least restrictive
(ExecutorFragmentContext
).
Since FragmentContextImpl
implements all of the interfaces listed
above, the facade pattern is used in order to cast a
FragmentContextImpl
object to the desired interface where-ever it is
needed. The facade pattern is powerful since it allows us to easily create
minimal context objects to be used in unit tests. Without the use of
interfaces and the facade pattern we would have to create a complete
FragmentContextImpl
object to unit test any part of the code that
depends on a context.
General guideline: Use the most narrow interface for the task. For example, "internal" operators don't need visibility to the networking functionality. Using the narrow interface allows unit testing without using mocking libraries. Often, the surrounding structure already has exposed the most narrow interface. If there are opportunities to clean up older code, we can do so as needed to make testing easier.
FragmentContext.ExecutorState
INJECTABLE_GETTER_METHODS
Constructor and Description |
---|
FragmentContextImpl(DrillbitContext dbContext,
BitControl.PlanFragment fragment,
FunctionImplementationRegistry funcRegistry)
Create a FragmentContext instance for non-root fragment.
|
FragmentContextImpl(DrillbitContext dbContext,
BitControl.PlanFragment fragment,
QueryContext queryContext,
UserClientConnection connection,
FunctionImplementationRegistry funcRegistry)
Create a FragmentContext instance for root fragment.
|
FragmentContextImpl(DrillbitContext dbContext,
BitControl.PlanFragment fragment,
UserClientConnection connection,
FunctionImplementationRegistry funcRegistry)
TODO: Remove this constructor when removing the SimpleRootExec (DRILL-2097).
|
getFunctionRegistry, getImplementationClass, getImplementationClass, getImplementationClass, getImplementationClass, getManagedBuffer, getManagedBuffer, getManagedBufferManager, replace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getFunctionRegistry, getImplementationClass, getImplementationClass, getImplementationClass, getImplementationClass, getManagedBuffer, getManagedBuffer, getManagedBufferManager, replace
public FragmentContextImpl(DrillbitContext dbContext, BitControl.PlanFragment fragment, FunctionImplementationRegistry funcRegistry) throws ExecutionSetupException
dbContext
- DrillbitContextfragment
- Fragment implementationfuncRegistry
- FunctionImplementationRegistryExecutionSetupException
- when unable to init fragment contextpublic FragmentContextImpl(DrillbitContext dbContext, BitControl.PlanFragment fragment, QueryContext queryContext, UserClientConnection connection, FunctionImplementationRegistry funcRegistry) throws ExecutionSetupException
dbContext
- DrillbitContextfragment
- Fragment implementationqueryContext
- QueryContextconnection
- UserClientConnectionfuncRegistry
- FunctionImplementationRegistryExecutionSetupException
- when unable to init fragment contextpublic FragmentContextImpl(DrillbitContext dbContext, BitControl.PlanFragment fragment, UserClientConnection connection, FunctionImplementationRegistry funcRegistry) throws ExecutionSetupException
ExecutionSetupException
public OptionManager getOptions()
FragmentContext
getOptions
in interface FragmentContext
public PhysicalPlanReader getPlanReader()
getPlanReader
in interface ExecutorFragmentContext
public ClusterCoordinator getClusterCoordinator()
getClusterCoordinator
in interface ExecutorFragmentContext
public void setBuffers(IncomingBuffers buffers)
setBuffers
in interface ExecutorFragmentContext
public QueryProfileStoreContext getProfileStoreContext()
getProfileStoreContext
in interface ExecutorFragmentContext
public Set<Map.Entry<UserServer.BitToUserConnection,UserServer.BitToUserConnectionConfig>> getUserConnections()
getUserConnections
in interface ExecutorFragmentContext
public void setExecutorState(FragmentContext.ExecutorState executorState)
setExecutorState
in interface RootFragmentContext
public void fail(Throwable cause)
public org.apache.calcite.schema.SchemaPlus getFullRootSchema()
getFullRootSchema
in interface FragmentContext
public FragmentStats getStats()
getStats
in interface RootFragmentContext
public Collection<CoordinationProtos.DrillbitEndpoint> getBits()
getBits
in interface ExecutorFragmentContext
public ContextInformation getContextInformation()
UdfUtilities
getContextInformation
in interface UdfUtilities
public CoordinationProtos.DrillbitEndpoint getForemanEndpoint()
getForemanEndpoint
in interface ExecutorFragmentContext
public CoordinationProtos.DrillbitEndpoint getEndpoint()
getEndpoint
in interface ExecutorFragmentContext
public Controller getController()
getController
in interface ExchangeFragmentContext
public OperatorCreatorRegistry getOperatorCreatorRegistry()
getOperatorCreatorRegistry
in interface ExecutorFragmentContext
public ExecutorService getScanDecodeExecutor()
getScanDecodeExecutor
in interface FragmentContext
public ExecutorService getScanExecutor()
getScanExecutor
in interface FragmentContext
public ExecProtos.FragmentHandle getHandle()
getHandle
in interface FragmentContext
public String getFragIdString()
getFragIdString
in interface FragmentContext
public boolean isUserAuthenticationEnabled()
isUserAuthenticationEnabled
in interface ExecutorFragmentContext
public void addRuntimeFilter(RuntimeFilterWritable runtimeFilter)
FragmentContext
addRuntimeFilter
in interface FragmentContext
runtimeFilter
- runtime filterpublic RuntimeFilterWritable getRuntimeFilter(long rfIdentifier)
getRuntimeFilter
in interface FragmentContext
public RuntimeFilterWritable getRuntimeFilter(long rfIdentifier, long maxWaitTime, TimeUnit timeUnit)
FragmentContext
getRuntimeFilter
in interface FragmentContext
rfIdentifier
- runtime filter identifiermaxWaitTime
- max wait timetimeUnit
- time unit@Deprecated public BufferAllocator getAllocator()
getAllocator
in interface FragmentContext
public BufferAllocator getRootAllocator()
ExecutorFragmentContext
getRootAllocator
in interface ExecutorFragmentContext
public BufferAllocator getNewChildAllocator(String operatorName, int operatorId, long initialReservation, long maximumReservation) throws OutOfMemoryException
getNewChildAllocator
in interface FragmentContext
OutOfMemoryException
public boolean isOverMemoryLimit()
public CodeCompiler getCompiler()
getCompiler
in interface FragmentContext
public AccountingUserConnection getUserDataTunnel()
getUserDataTunnel
in interface ExchangeFragmentContext
public AccountingDataTunnel getDataTunnel(CoordinationProtos.DrillbitEndpoint endpoint)
getDataTunnel
in interface ExchangeFragmentContext
public IncomingBuffers getBuffers()
getBuffers
in interface ExchangeFragmentContext
public OperatorContext newOperatorContext(PhysicalOperator popConfig, OperatorStats stats) throws OutOfMemoryException
newOperatorContext
in interface FragmentContext
OutOfMemoryException
public OperatorContext newOperatorContext(PhysicalOperator popConfig) throws OutOfMemoryException
newOperatorContext
in interface FragmentContext
OutOfMemoryException
public DrillConfig getConfig()
FragmentContext
getConfig
in interface FragmentContext
public FragmentContext.ExecutorState getExecutorState()
getExecutorState
in interface FragmentContext
public ExecutionControls getExecutionControls()
FragmentContext
getExecutionControls
in interface FragmentContext
public String getQueryUserName()
getQueryUserName
in interface FragmentContext
getQueryUserName
in class BaseFragmentContext
public UserBitShared.QueryId getQueryId()
getQueryId
in interface FragmentContext
getQueryId
in class BaseFragmentContext
UUID
of the current querypublic String getQueryIdString()
getQueryIdString
in interface FragmentContext
getQueryIdString
in class BaseFragmentContext
UUID
of the current querypublic boolean isImpersonationEnabled()
isImpersonationEnabled
in interface FragmentContext
public void close()
close
in interface AutoCloseable
close
in interface FragmentContext
public PartitionExplorer getPartitionExplorer()
UdfUtilities
DirectoryExplorers
for
example usages of this interface.getPartitionExplorer
in interface UdfUtilities
public ValueHolder getConstantValueHolder(String value, TypeProtos.MinorType type, org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,ValueHolder> holderInitializer)
UdfUtilities
getConstantValueHolder
in interface UdfUtilities
public ExecutorService getExecutor()
getExecutor
in interface FragmentContext
public void waitForSendComplete()
waitForSendComplete
in interface ExchangeFragmentContext
public WorkEventBus getWorkEventBus()
getWorkEventBus
in interface ExecutorFragmentContext
public boolean isBuffersDone()
protected BufferManager getBufferManager()
getBufferManager
in class BaseFragmentContext
public QueryContext.SqlStatementType getSQLStatementType()
FragmentContext
getSQLStatementType
in interface FragmentContext
getSQLStatementType
in class BaseFragmentContext
QueryContext.SqlStatementType
, if known.public MetastoreRegistry getMetastoreRegistry()
FragmentContext
getMetastoreRegistry
in interface FragmentContext
public AliasRegistryProvider getAliasRegistryProvider()
FragmentContext
getAliasRegistryProvider
in interface FragmentContext
public void requestMemory(RecordBatch requestor)
FragmentContext
OutOfMemoryException
.requestMemory
in interface FragmentContext
Copyright © 1970 The Apache Software Foundation. All rights reserved.