Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
|
Public Member Functions | |
Analyzer | getAnalyzer () |
void | analyze (Analyzer analyzer) throws AnalysisException |
abstract ArrayList< String > | getColLabels () |
abstract void | getMaterializedTupleIds (ArrayList< TupleId > tupleIdList) |
void | setWithClause (WithClause withClause) |
boolean | hasWithClause () |
WithClause | getWithClause () |
boolean | hasOrderByClause () |
boolean | hasLimit () |
long | getLimit () |
boolean | hasOffset () |
long | getOffset () |
SortInfo | getSortInfo () |
boolean | evaluateOrderBy () |
ArrayList< Expr > | getResultExprs () |
ArrayList< Expr > | getBaseTblResultExprs () |
void | setLimit (long limit) throws AnalysisException |
abstract void | materializeRequiredSlots (Analyzer analyzer) throws InternalException |
ArrayList< OrderByElement > | cloneOrderByElements () |
WithClause | cloneWithClause () |
abstract QueryStmt | clone () |
String | toSql () |
void | setIsExplain () |
boolean | isExplain () |
Protected Member Functions | |
void | createSortInfo (Analyzer analyzer) throws AnalysisException |
void | createSortTupleInfo (Analyzer analyzer) |
Expr | getFirstAmbiguousAlias (List< Expr > exprs) |
void | substituteOrdinals (List< Expr > exprs, String errorPrefix, Analyzer analyzer) throws AnalysisException |
void | materializeSlots (Analyzer analyzer, List< Expr > exprs) |
Protected Attributes | |
WithClause | withClause_ |
ArrayList< OrderByElement > | orderByElements_ |
LimitElement | limitElement_ |
ArrayList< Expr > | resultExprs_ = Lists.newArrayList() |
ArrayList< Expr > | baseTblResultExprs_ = Lists.newArrayList() |
final ExprSubstitutionMap | aliasSmap_ = new ExprSubstitutionMap() |
final ArrayList< Expr > | ambiguousAliasList_ = Lists.newArrayList() |
SortInfo | sortInfo_ |
boolean | evaluateOrderBy_ |
Analyzer | analyzer_ |
boolean | isExplain_ = false |
Package Functions | |
QueryStmt (ArrayList< OrderByElement > orderByElements, LimitElement limitElement) | |
Private Member Functions | |
void | analyzeLimit (Analyzer analyzer) throws AnalysisException |
Abstract base class for any statement that returns results via a list of result expressions, for example a SelectStmt or UnionStmt. Also maintains a map of expression substitutions for replacing expressions from ORDER BY or GROUP BY clauses with their corresponding result expressions. Used for sharing members/methods and some of the analysis code, in particular the analysis of the ORDER BY and LIMIT clauses.
Definition at line 41 of file QueryStmt.java.
|
inlinepackage |
Definition at line 85 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.limitElement_, com.cloudera.impala.analysis.QueryStmt.orderByElements_, and com.cloudera.impala.analysis.QueryStmt.sortInfo_.
|
inline |
Perform semantic analysis of node and all of its children. Throws exception if any errors found.
analyzer |
AnalysisException |
Implements com.cloudera.impala.analysis.ParseNode.
Definition at line 92 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.analyzeLimit(), and com.cloudera.impala.analysis.QueryStmt.hasWithClause().
|
inlineprivate |
Definition at line 99 of file QueryStmt.java.
References com.cloudera.impala.analysis.LimitElement.getOffsetExpr(), com.cloudera.impala.analysis.QueryStmt.hasOrderByClause(), com.cloudera.impala.analysis.QueryStmt.limitElement_, and com.cloudera.impala.analysis.LimitElement.toSql().
Referenced by com.cloudera.impala.analysis.QueryStmt.analyze().
|
abstract |
|
inline |
Definition at line 311 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.orderByElements_.
Referenced by com.cloudera.impala.analysis.ValuesStmt.clone(), com.cloudera.impala.analysis.UnionStmt.clone(), and com.cloudera.impala.analysis.SelectStmt.clone().
|
inline |
Definition at line 315 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.withClause_.
Referenced by com.cloudera.impala.analysis.ValuesStmt.clone(), com.cloudera.impala.analysis.UnionStmt.clone(), and com.cloudera.impala.analysis.SelectStmt.clone().
|
inlineprotected |
Creates sortInfo by resolving aliases and ordinals in the orderingExprs. If the query stmt is an inline view/union operand, then order-by with no limit with offset is not allowed, since that requires a sort and merging-exchange, and subsequent query execution would occur on a single machine. Sets evaluateOrderBy_ to false for ignored order-by w/o limit/offset in nested queries.
Definition at line 115 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.aliasSmap_, com.cloudera.impala.analysis.QueryStmt.clone(), com.cloudera.impala.analysis.QueryStmt.evaluateOrderBy_, com.cloudera.impala.analysis.QueryStmt.getFirstAmbiguousAlias(), com.cloudera.impala.analysis.QueryStmt.hasLimit(), com.cloudera.impala.analysis.QueryStmt.hasOffset(), com.cloudera.impala.analysis.QueryStmt.orderByElements_, com.cloudera.impala.analysis.QueryStmt.sortInfo_, com.cloudera.impala.analysis.QueryStmt.substituteOrdinals(), com.cloudera.impala.analysis.StatementBase.toSql(), and com.cloudera.impala.analysis.Expr.toSql().
Referenced by com.cloudera.impala.analysis.SelectStmt.analyze(), and com.cloudera.impala.analysis.UnionStmt.analyze().
|
inlineprotected |
Create a tuple descriptor for the single tuple that is materialized, sorted and output by the exec node implementing the sort. Done by materializing slot refs in the order-by and result expressions. Those SlotRefs in the ordering and result exprs are substituted with SlotRefs into the new tuple. This simplifies sorting logic for total (no limit) sorts. Done after analyzeAggregation() since ordering and result exprs may refer to the outputs of aggregation. Invoked for UnionStmt as well since TODO: We could do something more sophisticated than simply copying input slotrefs - e.g. compute some order-by expressions.
Definition at line 185 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.evaluateOrderBy_, and com.cloudera.impala.analysis.QueryStmt.resultExprs_.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyze(), and com.cloudera.impala.analysis.UnionStmt.analyze().
|
inline |
Definition at line 278 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.evaluateOrderBy_.
|
inline |
Definition at line 83 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.analyzer_.
Referenced by com.cloudera.impala.planner.SingleNodePlanner.createInlineViewPlan(), and com.cloudera.impala.analysis.StmtRewriter.rewrite().
|
inline |
Definition at line 280 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.baseTblResultExprs_.
Referenced by com.cloudera.impala.analysis.CreateOrAlterViewStmtBase.createColumnAndViewDefs(), com.cloudera.impala.analysis.UnionStmt.createMetadata(), com.cloudera.impala.planner.SingleNodePlanner.createSingleNodePlan(), and com.cloudera.impala.analysis.UnionStmt.materializeRequiredSlots().
|
abstract |
UnionStmt and SelectStmt have different implementations.
Referenced by com.cloudera.impala.analysis.CreateOrAlterViewStmtBase.createColumnAndViewDefs().
|
inlineprotected |
Return the first expr in exprs that is a non-unique alias. Return null if none of exprs is an ambiguous alias.
Definition at line 219 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.ambiguousAliasList_.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), and com.cloudera.impala.analysis.QueryStmt.createSortInfo().
|
inline |
Definition at line 274 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.QueryStmt.setLimit().
|
abstract |
Returns the materialized tuple ids of the output of this stmt. Used in case this stmt is part of an , since we need to know the materialized tupls ids of a TableRef. This call must be idempotent because it may be called more than once for Union stmt. TODO: The name of this function has become outdated due to analytics producing logical (non-materialized) tuples. Re-think and clean up.
|
inline |
Definition at line 276 of file QueryStmt.java.
|
inline |
Definition at line 279 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.resultExprs_.
Referenced by com.cloudera.impala.analysis.UnionStmt.setOperandSmap(), com.cloudera.impala.analysis.AnalyzeStmtsTest.testSlotRefPath(), and com.cloudera.impala.analysis.AnalyzeStmtsTest.TestStar().
|
inline |
Definition at line 277 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.sortInfo_.
|
inline |
Definition at line 271 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.withClause_.
|
inline |
Definition at line 273 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyze(), com.cloudera.impala.analysis.StmtRewriter.canRewriteCorrelatedSubquery(), com.cloudera.impala.analysis.QueryStmt.createSortInfo(), com.cloudera.impala.analysis.QueryStmt.setLimit(), and com.cloudera.impala.analysis.UnionStmt.toSql().
|
inline |
Definition at line 275 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.QueryStmt.createSortInfo(), and com.cloudera.impala.analysis.UnionStmt.toSql().
|
inline |
Definition at line 272 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.orderByElements_.
Referenced by com.cloudera.impala.analysis.QueryStmt.analyzeLimit(), and com.cloudera.impala.analysis.UnionStmt.toSql().
|
inline |
Definition at line 270 of file QueryStmt.java.
References com.cloudera.impala.analysis.QueryStmt.withClause_.
Referenced by com.cloudera.impala.analysis.QueryStmt.analyze().
|
inlineinherited |
Definition at line 43 of file StatementBase.java.
References com.cloudera.impala.analysis.StatementBase.isExplain_.
|
abstract |
Mark all slots that need to be materialized for the execution of this stmt. This excludes slots referenced in resultExprs (it depends on the consumer of the output of the stmt whether they'll be accessed) and single-table predicates (the PlanNode that materializes that tuple can decide whether evaluating those predicates requires slot materialization). This is called prior to plan tree generation and allows tuple-materializing PlanNodes to compute their tuple's mem layout.
|
inlineprotected |
Mark slots referenced in exprs as materialized.
Definition at line 303 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.UnionStmt.materializeRequiredSlots(), and com.cloudera.impala.analysis.SelectStmt.materializeRequiredSlots().
|
inlineinherited |
Definition at line 42 of file StatementBase.java.
References com.cloudera.impala.analysis.StatementBase.isExplain_.
|
inline |
Definition at line 281 of file QueryStmt.java.
References com.cloudera.impala.catalog.Type.BIGINT, com.cloudera.impala.analysis.QueryStmt.getLimit(), com.cloudera.impala.analysis.QueryStmt.hasLimit(), and com.cloudera.impala.analysis.QueryStmt.limitElement_.
Referenced by com.cloudera.impala.analysis.StmtRewriter.mergeExpr().
|
inline |
Definition at line 269 of file QueryStmt.java.
|
inlineprotected |
Substitute exprs of the form "<number>" with the corresponding expressions.
Definition at line 230 of file QueryStmt.java.
References com.cloudera.impala.analysis.Expr.getType(), com.cloudera.impala.analysis.QueryStmt.resultExprs_, and com.cloudera.impala.analysis.Expr.toSql().
Referenced by com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), and com.cloudera.impala.analysis.QueryStmt.createSortInfo().
|
inlineinherited |
Print SQL syntax corresponding to this node.
Implements com.cloudera.impala.analysis.ParseNode.
Definition at line 41 of file StatementBase.java.
Referenced by com.cloudera.impala.analysis.CreateUdaStmt.analyze(), and com.cloudera.impala.analysis.QueryStmt.createSortInfo().
|
protected |
Map of expression substitutions for replacing aliases in "order by" or "group by" clauses with their corresponding result expr.
Definition at line 62 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), com.cloudera.impala.analysis.UnionStmt.createMetadata(), and com.cloudera.impala.analysis.QueryStmt.createSortInfo().
|
protected |
Select list item alias does not have to be unique. This list contains all the non-unique aliases. For example, select int_col a, string_col a from alltypessmall; Both columns are using the same alias "a".
Definition at line 70 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.QueryStmt.getFirstAmbiguousAlias().
|
protected |
Definition at line 81 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.QueryStmt.getAnalyzer(), and com.cloudera.impala.analysis.SelectStmt.getTableAliasGenerator().
|
protected |
|
protected |
Definition at line 78 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyze(), com.cloudera.impala.analysis.UnionStmt.analyze(), com.cloudera.impala.analysis.QueryStmt.createSortInfo(), com.cloudera.impala.analysis.QueryStmt.createSortTupleInfo(), com.cloudera.impala.analysis.QueryStmt.evaluateOrderBy(), com.cloudera.impala.analysis.UnionStmt.getMaterializedTupleIds(), com.cloudera.impala.analysis.SelectStmt.getMaterializedTupleIds(), com.cloudera.impala.analysis.UnionStmt.materializeRequiredSlots(), and com.cloudera.impala.analysis.SelectStmt.materializeRequiredSlots().
|
protectedinherited |
|
protected |
Definition at line 45 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.QueryStmt.analyzeLimit(), com.cloudera.impala.analysis.ValuesStmt.clone(), com.cloudera.impala.analysis.UnionStmt.clone(), com.cloudera.impala.analysis.SelectStmt.clone(), com.cloudera.impala.analysis.QueryStmt.QueryStmt(), com.cloudera.impala.analysis.SelectStmt.returnsSingleRow(), and com.cloudera.impala.analysis.QueryStmt.setLimit().
|
protected |
Definition at line 44 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), com.cloudera.impala.analysis.QueryStmt.cloneOrderByElements(), com.cloudera.impala.analysis.UnionStmt.createMetadata(), com.cloudera.impala.analysis.QueryStmt.createSortInfo(), com.cloudera.impala.analysis.QueryStmt.hasOrderByClause(), com.cloudera.impala.analysis.QueryStmt.QueryStmt(), and com.cloudera.impala.analysis.SelectStmt.toSql().
|
protected |
Definition at line 52 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyze(), com.cloudera.impala.analysis.UnionStmt.analyze(), com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), com.cloudera.impala.analysis.SelectStmt.analyzeAnalytics(), com.cloudera.impala.analysis.SelectStmt.createAggInfo(), com.cloudera.impala.analysis.UnionStmt.createMetadata(), com.cloudera.impala.analysis.QueryStmt.createSortTupleInfo(), com.cloudera.impala.analysis.QueryStmt.getResultExprs(), com.cloudera.impala.analysis.SelectStmt.resolveInlineViewRefs(), com.cloudera.impala.analysis.QueryStmt.substituteOrdinals(), and com.cloudera.impala.analysis.UnionStmt.unnestOperands().
|
protected |
Definition at line 72 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.SelectStmt.analyze(), com.cloudera.impala.analysis.SelectStmt.analyzeAggregation(), com.cloudera.impala.analysis.SelectStmt.analyzeAnalytics(), com.cloudera.impala.analysis.QueryStmt.createSortInfo(), com.cloudera.impala.analysis.QueryStmt.getSortInfo(), and com.cloudera.impala.analysis.QueryStmt.QueryStmt().
|
protected |
Definition at line 42 of file QueryStmt.java.
Referenced by com.cloudera.impala.analysis.QueryStmt.cloneWithClause(), com.cloudera.impala.analysis.QueryStmt.getWithClause(), com.cloudera.impala.analysis.QueryStmt.hasWithClause(), com.cloudera.impala.analysis.ValuesStmt.toSql(), com.cloudera.impala.analysis.UnionStmt.toSql(), and com.cloudera.impala.analysis.SelectStmt.toSql().