Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Public Member Functions | |
SingleNodePlanner (PlannerContext ctx) | |
PlanNode | createSingleNodePlan () throws ImpalaException |
void | migrateConjunctsToInlineView (Analyzer analyzer, InlineViewRef inlineViewRef) |
Private Member Functions | |
PlanNode | createEmptyNode (QueryStmt stmt, Analyzer analyzer) throws InternalException |
PlanNode | createQueryPlan (QueryStmt stmt, Analyzer analyzer, boolean disableTopN) throws ImpalaException |
PlanNode | addUnassignedConjuncts (Analyzer analyzer, List< TupleId > tupleIds, PlanNode root) throws InternalException |
PlanNode | createCheapestJoinPlan (Analyzer analyzer, List< Pair< TableRef, PlanNode >> refPlans) throws ImpalaException |
PlanNode | createJoinPlan (Analyzer analyzer, TableRef leftmostRef, List< Pair< TableRef, PlanNode >> refPlans) throws ImpalaException |
PlanNode | createFromClauseJoinPlan (Analyzer analyzer, List< Pair< TableRef, PlanNode >> refPlans) throws ImpalaException |
PlanNode | createSelectPlan (SelectStmt selectStmt, Analyzer analyzer) throws ImpalaException |
PlanNode | createAggregationPlan (SelectStmt selectStmt, Analyzer analyzer, PlanNode root) throws InternalException |
PlanNode | createConstantSelectPlan (SelectStmt selectStmt, Analyzer analyzer) throws InternalException |
ValueRange | createHBaseValueRange (SlotDescriptor d, List< Expr > conjuncts) |
PlanNode | createInlineViewPlan (Analyzer analyzer, InlineViewRef inlineViewRef) throws ImpalaException |
boolean | canMigrateConjuncts (InlineViewRef inlineViewRef) |
PlanNode | createScanNode (Analyzer analyzer, TableRef tblRef) throws InternalException |
void | getHashLookupJoinConjuncts (Analyzer analyzer, List< TupleId > planIds, TableRef joinedTblRef, List< BinaryPredicate > joinConjuncts, List< Expr > joinPredicates) |
PlanNode | createJoinNode (Analyzer analyzer, PlanNode outer, PlanNode inner, TableRef outerRef, TableRef innerRef) throws ImpalaException |
PlanNode | createTableRefNode (Analyzer analyzer, TableRef tblRef) throws ImpalaException |
UnionNode | createUnionPlan (Analyzer analyzer, UnionStmt unionStmt, List< UnionOperand > unionOperands, PlanNode unionDistinctPlan) throws ImpalaException |
PlanNode | createUnionPlan (UnionStmt unionStmt, Analyzer analyzer) throws ImpalaException |
Private Attributes | |
final PlannerContext | ctx_ |
Static Private Attributes | |
static final Logger | LOG = LoggerFactory.getLogger(SingleNodePlanner.class) |
Constructs a non-executable single-node plan from an analyzed parse tree. The single-node plan does not contain data exchanges or data-reduction optimizations such as local aggregations that are important for distributed execution. The single-node plan needs to be wrapped in a plan fragment for it to be executable.
Definition at line 71 of file SingleNodePlanner.java.
|
inline |
Definition at line 76 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.ctx_.
|
inlineprivate |
If there are unassigned conjuncts that are bound by tupleIds or if there are slot equivalences for tupleIds that have not yet been enforced, returns a SelectNode on top of root that evaluates those conjuncts; otherwise returns root unchanged. TODO: change this to assign the unassigned conjuncts to root itself, if that is semantically correct
Definition at line 212 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.ctx_, and com.cloudera.impala.planner.PlannerContext.getNextNodeId().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), and com.cloudera.impala.planner.SingleNodePlanner.createUnionPlan().
|
inlineprivate |
Checks if conjuncts can be migrated into an inline view.
Definition at line 838 of file SingleNodePlanner.java.
References com.cloudera.impala.analysis.InlineViewRef.getViewStmt().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), and com.cloudera.impala.planner.SingleNodePlanner.migrateConjunctsToInlineView().
|
inlineprivate |
Returns a new AggregationNode that materializes the aggregation of the given stmt. Assigns conjuncts from the Having clause to the returned node.
Definition at line 564 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.ctx_, com.cloudera.impala.planner.PlannerContext.getNextNodeId(), and com.cloudera.impala.analysis.AggregateInfo.isDistinctAgg().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan().
|
inlineprivate |
Return the cheapest plan that materializes the joins of all TblRefs in refPlans. Assumes that refPlans are in the order as they originally appeared in the query. For this plan:
Definition at line 246 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createJoinPlan(), com.cloudera.impala.planner.PlanNode.getAvgRowSize(), com.cloudera.impala.planner.PlanNode.getCardinality(), com.cloudera.impala.analysis.JoinOperator.isCrossJoin(), com.cloudera.impala.analysis.JoinOperator.isNullAwareLeftAntiJoin(), and com.cloudera.impala.analysis.JoinOperator.isOuterJoin().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan().
|
inlineprivate |
Returns a UnionNode that materializes the exprs of the constant selectStmt. Replaces the resultExprs of the selectStmt with SlotRefs into the materialized tuple.
Definition at line 592 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.ctx_, and com.cloudera.impala.planner.PlannerContext.getNextNodeId().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan().
|
inlineprivate |
Creates an EmptyNode that 'materializes' the tuples of the given stmt.
Definition at line 127 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.ctx_, and com.cloudera.impala.planner.PlannerContext.getNextNodeId().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), and com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan().
|
inlineprivate |
Return a plan with joins in the order of refPlans (= FROM clause order).
Definition at line 465 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createJoinNode().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan().
|
inlineprivate |
Transform '=', '<[=]' and '>[=]' comparisons for given slot into ValueRange. Also removes those predicates which were used for the construction of ValueRange from 'conjuncts_'. Only looks at comparisons w/ string constants (ie, the bounds of the result can be evaluated with Expr::GetValue(NULL)). HBase row key filtering works only if the row key is mapped to a string column and the expression is a string constant expression. If there are multiple competing comparison predicates that could be used to construct a ValueRange, only the first one from each category is chosen.
Definition at line 632 of file SingleNodePlanner.java.
References com.cloudera.impala.analysis.BinaryPredicate.getOp(), com.cloudera.impala.analysis.Expr.isConstant(), com.cloudera.impala.analysis.BinaryPredicate.Operator.Operator(), and com.cloudera.impala.catalog.Type.STRING.
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createScanNode().
|
inlineprivate |
Returns plan tree for an inline view ref:
Definition at line 684 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.addUnassignedConjuncts(), com.cloudera.impala.planner.SingleNodePlanner.canMigrateConjuncts(), com.cloudera.impala.planner.SingleNodePlanner.createEmptyNode(), com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, com.cloudera.impala.analysis.QueryStmt.getAnalyzer(), com.cloudera.impala.planner.PlannerContext.getNextNodeId(), com.cloudera.impala.analysis.SelectStmt.getTableRefs(), com.cloudera.impala.planner.PlanNode.getTupleIds(), and com.cloudera.impala.planner.SingleNodePlanner.migrateConjunctsToInlineView().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createTableRefNode().
|
inlineprivate |
Create a node to join outer with inner. Either the outer or the inner may be a plan created from a table ref (but not both), and the corresponding outer/innerRef should be non-null.
Definition at line 977 of file SingleNodePlanner.java.
References com.cloudera.impala.analysis.JoinOperator.CROSS_JOIN, com.cloudera.impala.planner.SingleNodePlanner.getHashLookupJoinConjuncts(), com.cloudera.impala.analysis.JoinOperator.INNER_JOIN, and com.cloudera.impala.analysis.BinaryPredicate.isNullMatchingEq().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createFromClauseJoinPlan(), and com.cloudera.impala.planner.SingleNodePlanner.createJoinPlan().
|
inlineprivate |
Returns a plan with leftmostRef's plan as its leftmost input; the joins are in decreasing order of selectiveness (percentage of rows they eliminate). The leftmostRef's join will be inverted if it is an outer/semi/cross join.
Definition at line 311 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createJoinNode(), com.cloudera.impala.planner.PlanNode.getCardinality(), com.cloudera.impala.analysis.TableRef.getJoinOp(), com.cloudera.impala.analysis.TableRef.getLeftTblRef(), and com.cloudera.impala.analysis.TableRef.getUniqueAlias().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createCheapestJoinPlan().
|
inlineprivate |
Create plan tree for single-node execution. Generates PlanNodes for the Select/Project/Join/Union [All]/Group by/Having/Order by clauses of the query stmt.
Definition at line 145 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createEmptyNode(), com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan(), com.cloudera.impala.planner.SingleNodePlanner.createUnionPlan(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, and com.cloudera.impala.planner.PlannerContext.getNextNodeId().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), com.cloudera.impala.planner.SingleNodePlanner.createSingleNodePlan(), and com.cloudera.impala.planner.SingleNodePlanner.createUnionPlan().
|
inlineprivate |
Create node for scanning all data files of a particular table.
Definition at line 848 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createHBaseValueRange(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, com.cloudera.impala.planner.PlannerContext.getNextNodeId(), and com.cloudera.impala.analysis.SlotDescriptor.getType().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createTableRefNode().
|
inlineprivate |
Create tree of PlanNodes that implements the Select/Project/Join/Group by/Having of the selectStmt query block.
Definition at line 484 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createAggregationPlan(), com.cloudera.impala.planner.SingleNodePlanner.createCheapestJoinPlan(), com.cloudera.impala.planner.SingleNodePlanner.createConstantSelectPlan(), com.cloudera.impala.planner.SingleNodePlanner.createFromClauseJoinPlan(), com.cloudera.impala.planner.SingleNodePlanner.createTableRefNode(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, and com.cloudera.impala.planner.PlannerContext.getNextNodeId().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan().
|
inline |
Generates and returns the root of the single-node plan for the analyzed parse tree in the planner context. The planning process recursively walks the parse tree and performs the following actions. In the top-down phase over query statements:
Definition at line 96 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, com.cloudera.impala.analysis.QueryStmt.getBaseTblResultExprs(), and com.cloudera.impala.planner.PlannerContext.getQueryOptions().
|
inlineprivate |
Create a tree of PlanNodes for the given tblRef, which can be a BaseTableRef, CollectionTableRef or an InlineViewRef.
Definition at line 1080 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), and com.cloudera.impala.planner.SingleNodePlanner.createScanNode().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan().
|
inlineprivate |
Create a plan tree corresponding to 'unionOperands' for the given unionStmt. The individual operands' plan trees are attached to a single UnionNode. If unionDistinctPlan is not null, it is expected to contain the plan for the distinct portion of the given unionStmt. The unionDistinctPlan is then added as a child of the returned UnionNode.
Definition at line 1098 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, com.cloudera.impala.planner.PlannerContext.getNextNodeId(), and com.cloudera.impala.analysis.SelectStmt.getTableRefs().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan(), and com.cloudera.impala.planner.SingleNodePlanner.createUnionPlan().
|
inlineprivate |
Returns plan tree for unionStmt:
Definition at line 1141 of file SingleNodePlanner.java.
References com.cloudera.impala.planner.SingleNodePlanner.addUnassignedConjuncts(), com.cloudera.impala.planner.SingleNodePlanner.createUnionPlan(), com.cloudera.impala.planner.SingleNodePlanner.ctx_, and com.cloudera.impala.planner.PlannerContext.getNextNodeId().
|
inlineprivate |
Return all applicable conjuncts for join between a plan tree and a single TableRef; the conjuncts can be used for hash table lookups.
Definition at line 912 of file SingleNodePlanner.java.
References com.cloudera.impala.analysis.TableRef.getDesc().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createJoinNode().
|
inline |
Migrates unassigned conjuncts into an inline view. Conjuncts are not migrated into the inline view if the view has a LIMIT/OFFSET clause or if the view's stmt computes analytic functions (see IMPALA-1243/IMPALA-1900). The reason is that analytic functions compute aggregates over their entire input, and applying filters from the enclosing scope before the aggregate computation would alter the results. This is unlike regular aggregate computation, which only makes the output of the computation visible to the enclosing scope, so that filters from the enclosing scope can be safely applied (to the grouping cols, say).
Definition at line 769 of file SingleNodePlanner.java.
References com.cloudera.impala.analysis.Analyzer.canEvalPredicate(), com.cloudera.impala.planner.SingleNodePlanner.canMigrateConjuncts(), com.cloudera.impala.analysis.TableRef.getId(), and com.cloudera.impala.analysis.Expr.isRegisteredPredicate().
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan().
|
private |
Definition at line 74 of file SingleNodePlanner.java.
Referenced by com.cloudera.impala.planner.SingleNodePlanner.addUnassignedConjuncts(), com.cloudera.impala.planner.SingleNodePlanner.createAggregationPlan(), com.cloudera.impala.planner.SingleNodePlanner.createConstantSelectPlan(), com.cloudera.impala.planner.SingleNodePlanner.createEmptyNode(), com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), com.cloudera.impala.planner.SingleNodePlanner.createQueryPlan(), com.cloudera.impala.planner.SingleNodePlanner.createScanNode(), com.cloudera.impala.planner.SingleNodePlanner.createSelectPlan(), com.cloudera.impala.planner.SingleNodePlanner.createSingleNodePlan(), com.cloudera.impala.planner.SingleNodePlanner.createUnionPlan(), and com.cloudera.impala.planner.SingleNodePlanner.SingleNodePlanner().
|
staticprivate |
Definition at line 72 of file SingleNodePlanner.java.