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.ExecutorStateINJECTABLE_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, replaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetFunctionRegistry, getImplementationClass, getImplementationClass, getImplementationClass, getImplementationClass, getManagedBuffer, getManagedBuffer, getManagedBufferManager, replacepublic 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
ExecutionSetupExceptionpublic OptionManager getOptions()
FragmentContextgetOptions in interface FragmentContextpublic PhysicalPlanReader getPlanReader()
getPlanReader in interface ExecutorFragmentContextpublic ClusterCoordinator getClusterCoordinator()
getClusterCoordinator in interface ExecutorFragmentContextpublic void setBuffers(IncomingBuffers buffers)
setBuffers in interface ExecutorFragmentContextpublic QueryProfileStoreContext getProfileStoreContext()
getProfileStoreContext in interface ExecutorFragmentContextpublic Set<Map.Entry<UserServer.BitToUserConnection,UserServer.BitToUserConnectionConfig>> getUserConnections()
getUserConnections in interface ExecutorFragmentContextpublic void setExecutorState(FragmentContext.ExecutorState executorState)
setExecutorState in interface RootFragmentContextpublic void fail(Throwable cause)
public org.apache.calcite.schema.SchemaPlus getFullRootSchema()
getFullRootSchema in interface FragmentContextpublic FragmentStats getStats()
getStats in interface RootFragmentContextpublic Collection<CoordinationProtos.DrillbitEndpoint> getBits()
getBits in interface ExecutorFragmentContextpublic ContextInformation getContextInformation()
UdfUtilitiesgetContextInformation in interface UdfUtilitiespublic CoordinationProtos.DrillbitEndpoint getForemanEndpoint()
getForemanEndpoint in interface ExecutorFragmentContextpublic CoordinationProtos.DrillbitEndpoint getEndpoint()
getEndpoint in interface ExecutorFragmentContextpublic Controller getController()
getController in interface ExchangeFragmentContextpublic OperatorCreatorRegistry getOperatorCreatorRegistry()
getOperatorCreatorRegistry in interface ExecutorFragmentContextpublic ExecutorService getScanDecodeExecutor()
getScanDecodeExecutor in interface FragmentContextpublic ExecutorService getScanExecutor()
getScanExecutor in interface FragmentContextpublic ExecProtos.FragmentHandle getHandle()
getHandle in interface FragmentContextpublic String getFragIdString()
getFragIdString in interface FragmentContextpublic boolean isUserAuthenticationEnabled()
isUserAuthenticationEnabled in interface ExecutorFragmentContextpublic void addRuntimeFilter(RuntimeFilterWritable runtimeFilter)
FragmentContextaddRuntimeFilter in interface FragmentContextruntimeFilter - runtime filterpublic RuntimeFilterWritable getRuntimeFilter(long rfIdentifier)
getRuntimeFilter in interface FragmentContextpublic RuntimeFilterWritable getRuntimeFilter(long rfIdentifier, long maxWaitTime, TimeUnit timeUnit)
FragmentContextgetRuntimeFilter in interface FragmentContextrfIdentifier - runtime filter identifiermaxWaitTime - max wait timetimeUnit - time unit@Deprecated public BufferAllocator getAllocator()
getAllocator in interface FragmentContextpublic BufferAllocator getRootAllocator()
ExecutorFragmentContextgetRootAllocator in interface ExecutorFragmentContextpublic BufferAllocator getNewChildAllocator(String operatorName, int operatorId, long initialReservation, long maximumReservation) throws OutOfMemoryException
getNewChildAllocator in interface FragmentContextOutOfMemoryExceptionpublic boolean isOverMemoryLimit()
public CodeCompiler getCompiler()
getCompiler in interface FragmentContextpublic AccountingUserConnection getUserDataTunnel()
getUserDataTunnel in interface ExchangeFragmentContextpublic AccountingDataTunnel getDataTunnel(CoordinationProtos.DrillbitEndpoint endpoint)
getDataTunnel in interface ExchangeFragmentContextpublic IncomingBuffers getBuffers()
getBuffers in interface ExchangeFragmentContextpublic OperatorContext newOperatorContext(PhysicalOperator popConfig, OperatorStats stats) throws OutOfMemoryException
newOperatorContext in interface FragmentContextOutOfMemoryExceptionpublic OperatorContext newOperatorContext(PhysicalOperator popConfig) throws OutOfMemoryException
newOperatorContext in interface FragmentContextOutOfMemoryExceptionpublic DrillConfig getConfig()
FragmentContextgetConfig in interface FragmentContextpublic FragmentContext.ExecutorState getExecutorState()
getExecutorState in interface FragmentContextpublic ExecutionControls getExecutionControls()
FragmentContextgetExecutionControls in interface FragmentContextpublic String getQueryUserName()
getQueryUserName in interface FragmentContextgetQueryUserName in class BaseFragmentContextpublic UserBitShared.QueryId getQueryId()
getQueryId in interface FragmentContextgetQueryId in class BaseFragmentContextUUID of the current querypublic String getQueryIdString()
getQueryIdString in interface FragmentContextgetQueryIdString in class BaseFragmentContextUUID of the current querypublic boolean isImpersonationEnabled()
isImpersonationEnabled in interface FragmentContextpublic void close()
close in interface AutoCloseableclose in interface FragmentContextpublic PartitionExplorer getPartitionExplorer()
UdfUtilitiesDirectoryExplorers for
example usages of this interface.getPartitionExplorer in interface UdfUtilitiespublic ValueHolder getConstantValueHolder(String value, TypeProtos.MinorType type, org.apache.drill.shaded.guava.com.google.common.base.Function<DrillBuf,ValueHolder> holderInitializer)
UdfUtilitiesgetConstantValueHolder in interface UdfUtilitiespublic ExecutorService getExecutor()
getExecutor in interface FragmentContextpublic void waitForSendComplete()
waitForSendComplete in interface ExchangeFragmentContextpublic WorkEventBus getWorkEventBus()
getWorkEventBus in interface ExecutorFragmentContextpublic boolean isBuffersDone()
protected BufferManager getBufferManager()
getBufferManager in class BaseFragmentContextpublic QueryContext.SqlStatementType getSQLStatementType()
FragmentContextgetSQLStatementType in interface FragmentContextgetSQLStatementType in class BaseFragmentContextQueryContext.SqlStatementType, if known.public MetastoreRegistry getMetastoreRegistry()
FragmentContextgetMetastoreRegistry in interface FragmentContextpublic void requestMemory(RecordBatch requestor)
FragmentContextOutOfMemoryException.requestMemory in interface FragmentContextCopyright © 2021 The Apache Software Foundation. All rights reserved.