Class SimpleParallelizer
java.lang.Object
org.apache.drill.exec.planner.fragment.SimpleParallelizer
- All Implemented Interfaces:
ParallelizationParameters
,QueryParallelizer
- Direct Known Subclasses:
DefaultQueryParallelizer
,QueueQueryParallelizer
The simple parallelizer determines the level of parallelization of a plan
based on the cost of the underlying operations. It doesn't take into account
system load or other factors. Based on the cost of the query, the
parallelization for each major fragment will be determined. Once the amount
of parallelization is done, assignment is done based on round robin
assignment ordered by operator affinity (locality) to available execution
Drillbits.
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected static class
Designed to setup initial values for arriving fragment accounting. -
Constructor Summary
ModifierConstructorDescriptionprotected
SimpleParallelizer
(long parallelizationThreshold, int maxWidthPerNode, int maxGlobalWidth, double affinityFactor) protected
SimpleParallelizer
(QueryContext context) -
Method Summary
Modifier and TypeMethodDescriptionabstract void
adjustMemory
(PlanningSet planningSet, Set<Wrapper> roots, Collection<CoordinationProtos.DrillbitEndpoint> activeEndpoints) void
collectStatsAndParallelizeFragments
(PlanningSet planningSet, Set<Wrapper> roots, Collection<CoordinationProtos.DrillbitEndpoint> activeEndpoints) Traverse all the major fragments and parallelize each major fragment based on collected stats.final QueryWorkUnit
generateWorkUnit
(OptionList options, CoordinationProtos.DrillbitEndpoint foremanNode, UserBitShared.QueryId queryId, Collection<CoordinationProtos.DrillbitEndpoint> activeEndpoints, Fragment rootFragment, UserSession session, BitControl.QueryContextInformation queryContextInfo) The starting function for the whole parallelization and memory computation logic.protected QueryWorkUnit
generateWorkUnit
(OptionList options, CoordinationProtos.DrillbitEndpoint foremanNode, UserBitShared.QueryId queryId, Fragment rootNode, PlanningSet planningSet, UserSession session, BitControl.QueryContextInformation queryContextInfo) double
int
int
protected abstract BiFunction<CoordinationProtos.DrillbitEndpoint,
PhysicalOperator, Long> getRootFragments
(PlanningSet planningSet) long
getSplitFragments
(OptionList options, CoordinationProtos.DrillbitEndpoint foremanNode, UserBitShared.QueryId queryId, Collection<CoordinationProtos.DrillbitEndpoint> activeEndpoints, PhysicalPlanReader reader, Fragment rootFragment, UserSession session, BitControl.QueryContextInformation queryContextInfo) Create multiple physical plans from original query planning, it will allow execute them eventually independentlyvoid
initFragmentWrappers
(Fragment rootFragment, PlanningSet planningSet) prepareFragmentTree
(Fragment rootFragment) protected void
Call operation on each fragment.
-
Constructor Details
-
SimpleParallelizer
-
SimpleParallelizer
protected SimpleParallelizer(long parallelizationThreshold, int maxWidthPerNode, int maxGlobalWidth, double affinityFactor)
-
-
Method Details
-
getSliceTarget
public long getSliceTarget()- Specified by:
getSliceTarget
in interfaceParallelizationParameters
- Returns:
- Configured max width per slice of work.
-
getMaxWidthPerNode
public int getMaxWidthPerNode()- Specified by:
getMaxWidthPerNode
in interfaceParallelizationParameters
- Returns:
- Configured maximum allowed number of parallelization units per node.
-
getMaxGlobalWidth
public int getMaxGlobalWidth()- Specified by:
getMaxGlobalWidth
in interfaceParallelizationParameters
- Returns:
- Configured maximum allowed number of parallelization units per all nodes in the cluster.
-
getAffinityFactor
public double getAffinityFactor()- Specified by:
getAffinityFactor
in interfaceParallelizationParameters
- Returns:
- Factor by which a node with endpoint affinity will be favored while creating assignment.
-
getRootFragments
-
prepareFragmentTree
-
collectStatsAndParallelizeFragments
public void collectStatsAndParallelizeFragments(PlanningSet planningSet, Set<Wrapper> roots, Collection<CoordinationProtos.DrillbitEndpoint> activeEndpoints) throws PhysicalOperatorSetupException Traverse all the major fragments and parallelize each major fragment based on collected stats. The children fragments are parallelized before a parent fragment.- Parameters:
planningSet
- Set of all major fragments and their context.roots
- Root nodes of the plan.activeEndpoints
- currently active drillbit endpoints.- Throws:
PhysicalOperatorSetupException
-
adjustMemory
public abstract void adjustMemory(PlanningSet planningSet, Set<Wrapper> roots, Collection<CoordinationProtos.DrillbitEndpoint> activeEndpoints) throws PhysicalOperatorSetupException - Throws:
PhysicalOperatorSetupException
-
initFragmentWrappers
-
traverse
protected void traverse(Wrapper fragmentWrapper, Consumer<Wrapper> operation) throws PhysicalOperatorSetupException Call operation on each fragment. Traversal calls operation on child fragments before calling it on the parent fragment.- Throws:
PhysicalOperatorSetupException
-
getMemory
protected abstract BiFunction<CoordinationProtos.DrillbitEndpoint,PhysicalOperator, getMemory()Long>
-