Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Classes | |
class | PartitionGroup |
class | SortGroup |
class | WindowGroup |
Public Member Functions | |
AnalyticPlanner (List< TupleId > stmtTupleIds, AnalyticInfo analyticInfo, Analyzer analyzer, PlannerContext ctx) | |
PlanNode | createSingleNodePlan (PlanNode root, List< Expr > groupingExprs, List< Expr > inputPartitionExprs) throws ImpalaException |
Private Member Functions | |
void | mergeSortGroups (List< SortGroup > sortGroups) |
void | mergePartitionGroups (List< PartitionGroup > partitionGroups, int numNodes) |
void | computeInputPartitionExprs (List< PartitionGroup > partitionGroups, List< Expr > groupingExprs, int numNodes, List< Expr > inputPartitionExprs) |
void | orderGroups (List< PartitionGroup > partitionGroups) |
SortInfo | createSortInfo (PlanNode input, List< Expr > sortExprs, List< Boolean > isAsc, List< Boolean > nullsFirst) |
PlanNode | createSortGroupPlan (PlanNode root, SortGroup sortGroup, List< Expr > partitionExprs) throws ImpalaException |
Expr | createNullMatchingEquals (List< Expr > exprs, TupleId inputTid, ExprSubstitutionMap bufferedSmap) |
Expr | createNullMatchingEqualsAux (List< Expr > elements, int i, TupleId inputTid, ExprSubstitutionMap bufferedSmap) |
List< WindowGroup > | collectWindowGroups () |
List< SortGroup > | collectSortGroups (List< WindowGroup > windowGroups) |
List< PartitionGroup > | collectPartitionGroups (List< SortGroup > sortGroups) |
Private Attributes | |
final List< TupleId > | stmtTupleIds_ |
final AnalyticInfo | analyticInfo_ |
final Analyzer | analyzer_ |
final PlannerContext | ctx_ |
Static Private Attributes | |
static final Logger | LOG = LoggerFactory.getLogger(AnalyticPlanner.class) |
The analytic planner adds plan nodes to an existing plan tree in order to implement the AnalyticInfo of a given query stmt. The resulting plan reflects similarities among analytic exprs with respect to partitioning, ordering and windowing to reduce data exchanges and sorts (the exchanges and sorts are currently not minimal). The generated plan has the following structure: ... ( ( ( analytic node <– group of analytic exprs with compatible window )+ <– group of analytic exprs with compatible ordering sort node? )+ <– group of analytic exprs with compatible partitioning hash exchange? )* <– group of analytic exprs that have different partitioning input plan node ...
Definition at line 68 of file AnalyticPlanner.java.
|
inline |
Definition at line 83 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyticInfo_, com.cloudera.impala.planner.AnalyticPlanner.analyzer_, com.cloudera.impala.planner.AnalyticPlanner.ctx_, com.cloudera.impala.analysis.AggregateInfoBase.getOutputTupleId(), and com.cloudera.impala.planner.AnalyticPlanner.stmtTupleIds_.
|
inlineprivate |
Extract a minimal set of PartitionGroups from sortGroups.
Definition at line 812 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Partitions the windowGroups into SortGroups based on compatible order by exprs.
Definition at line 732 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Extract a minimal set of WindowGroups from analyticExprs.
Definition at line 603 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyticInfo_, com.cloudera.impala.analysis.AnalyticInfo.getAnalyticExprs(), and com.cloudera.impala.analysis.AggregateInfoBase.getOutputTupleDesc().
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Determine the partition group that has the maximum intersection in terms of the estimated ndv of the partition exprs with groupingExprs. That partition group is placed at the front of partitionGroups, with its partition exprs reduced to the intersection, and the intersecting groupingExprs are returned in inputPartitionExprs.
Definition at line 200 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyzer_.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Create a predicate that checks if all exprs are equal or both sides are null.
Definition at line 439 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyzer_, and com.cloudera.impala.planner.AnalyticPlanner.createNullMatchingEqualsAux().
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSortGroupPlan().
|
inlineprivate |
Create an unanalyzed predicate that checks if elements >= i are equal or both sides are null.
The predicate has the form ((lhs[i] is null && rhs[i] is null) || ( lhs[i] is not null && rhs[i] is not null && lhs[i] = rhs[i])) && <createEqualsAux(i + 1)>
Definition at line 456 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyzer_.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createNullMatchingEquals().
|
inline |
Return plan tree that augments 'root' with plan nodes that implement single-node evaluation of the AnalyticExprs in analyticInfo. This plan takes into account a possible hash partition of its input on 'groupingExprs'; if this is non-null, it returns in 'inputPartitionExprs' a subset of the grouping exprs which should be used for the aggregate hash partitioning during the parallelization of 'root'. TODO: when generating sort orders for the sort groups, optimize the ordering of the partition exprs (so that subsequent sort operations see the input sorted on a prefix of their required sort exprs) TODO: when merging sort groups, recognize equivalent exprs (using the equivalence classes) rather than looking for expr equality
Definition at line 109 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyzer_, com.cloudera.impala.planner.AnalyticPlanner.collectPartitionGroups(), com.cloudera.impala.planner.AnalyticPlanner.collectSortGroups(), com.cloudera.impala.planner.AnalyticPlanner.collectWindowGroups(), com.cloudera.impala.planner.AnalyticPlanner.computeInputPartitionExprs(), com.cloudera.impala.planner.AnalyticPlanner.createSortGroupPlan(), com.cloudera.impala.planner.AnalyticPlanner.mergePartitionGroups(), com.cloudera.impala.planner.AnalyticPlanner.mergeSortGroups(), and com.cloudera.impala.planner.AnalyticPlanner.orderGroups().
|
inlineprivate |
Create plan tree for the entire sort group, including all contained window groups. Marks the SortNode as requiring its input to be partitioned if partitionExprs is not null (partitionExprs represent the data partition of the entire partition group of which this sort group is a part).
Definition at line 334 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyzer_, com.cloudera.impala.planner.AnalyticPlanner.createNullMatchingEquals(), com.cloudera.impala.planner.AnalyticPlanner.createSortInfo(), com.cloudera.impala.planner.AnalyticPlanner.ctx_, com.cloudera.impala.planner.PlannerContext.getNextNodeId(), com.cloudera.impala.analysis.OrderByElement.getOrderByExprs(), com.cloudera.impala.planner.AnalyticPlanner.WindowGroup.logicalToPhysicalSmap, com.cloudera.impala.planner.AnalyticPlanner.WindowGroup.orderByElements, com.cloudera.impala.planner.AnalyticPlanner.WindowGroup.partitionByExprs, com.cloudera.impala.planner.AnalyticPlanner.WindowGroup.physicalIntermediateTuple, com.cloudera.impala.planner.AnalyticPlanner.WindowGroup.physicalOutputTuple, com.cloudera.impala.planner.SortNode.setIsAnalyticSort(), com.cloudera.impala.planner.AnalyticPlanner.stmtTupleIds_, com.cloudera.impala.analysis.OrderByElement.substitute(), com.cloudera.impala.analysis.Expr.substituteList(), and com.cloudera.impala.planner.DataPartition.UNPARTITIONED.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Create SortInfo, including sort tuple, to sort entire input row on sortExprs.
Definition at line 270 of file AnalyticPlanner.java.
References com.cloudera.impala.planner.AnalyticPlanner.analyzer_, com.cloudera.impala.analysis.TupleDescriptor.getSlots(), com.cloudera.impala.planner.PlanNode.getTupleIds(), com.cloudera.impala.analysis.Expr.isBoundByTupleIds(), and com.cloudera.impala.analysis.Expr.substituteList().
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSortGroupPlan().
|
inlineprivate |
Coalesce partition groups for which the intersection of their partition exprs has ndv estimate > numNodes, so that the resulting plan still parallelizes across all nodes.
Definition at line 168 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Coalesce sort groups that have compatible partition-by exprs and have a prefix relationship.
Definition at line 145 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
inlineprivate |
Order partition groups (and the sort groups within them) by increasing totalOutputTupleSize. This minimizes the total volume of data that needs to be repartitioned and sorted. Also move the non-partitioning partition group to the end.
Definition at line 238 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan().
|
private |
Definition at line 79 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.AnalyticPlanner(), and com.cloudera.impala.planner.AnalyticPlanner.collectWindowGroups().
|
private |
Definition at line 80 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.AnalyticPlanner(), com.cloudera.impala.planner.AnalyticPlanner.computeInputPartitionExprs(), com.cloudera.impala.planner.AnalyticPlanner.createNullMatchingEquals(), com.cloudera.impala.planner.AnalyticPlanner.createNullMatchingEqualsAux(), com.cloudera.impala.planner.AnalyticPlanner.createSingleNodePlan(), com.cloudera.impala.planner.AnalyticPlanner.createSortGroupPlan(), and com.cloudera.impala.planner.AnalyticPlanner.createSortInfo().
|
private |
Definition at line 81 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.AnalyticPlanner(), and com.cloudera.impala.planner.AnalyticPlanner.createSortGroupPlan().
|
staticprivate |
Definition at line 69 of file AnalyticPlanner.java.
|
private |
Definition at line 77 of file AnalyticPlanner.java.
Referenced by com.cloudera.impala.planner.AnalyticPlanner.AnalyticPlanner(), and com.cloudera.impala.planner.AnalyticPlanner.createSortGroupPlan().