Impala
Impalaistheopensource,nativeanalyticdatabaseforApacheHadoop.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
com.cloudera.impala.planner.PlanNode Class Referenceabstract
Inheritance diagram for com.cloudera.impala.planner.PlanNode:
Collaboration diagram for com.cloudera.impala.planner.PlanNode:

Public Member Functions

PlanNodeId getId ()
 
void setId (PlanNodeId id)
 
long getLimit ()
 
boolean hasLimit ()
 
long getPerHostMemCost ()
 
long getCardinality ()
 
int getNumNodes ()
 
float getAvgRowSize ()
 
void setFragment (PlanFragment fragment)
 
PlanFragment getFragment ()
 
List< ExprgetConjuncts ()
 
ExprSubstitutionMap getOutputSmap ()
 
void setOutputSmap (ExprSubstitutionMap smap)
 
Set< ExprIdgetAssignedConjuncts ()
 
void setAssignedConjuncts (Set< ExprId > conjuncts)
 
void setLimit (long limit)
 
void unsetLimit ()
 
ArrayList< TupleIdgetTupleIds ()
 
ArrayList< TupleIdgetTblRefIds ()
 
void setTblRefIds (ArrayList< TupleId > ids)
 
Set< TupleIdgetNullableTupleIds ()
 
void addConjuncts (List< Expr > conjuncts)
 
void transferConjuncts (PlanNode recipient)
 
String getExplainString ()
 
TPlan treeToThrift ()
 
void init (Analyzer analyzer) throws InternalException
 
boolean isBlockingNode ()
 
void computeCosts (TQueryOptions queryOptions)
 
long getInputCardinality ()
 

Static Public Member Functions

static long addCardinalities (long a, long b)
 
static long multiplyCardinalities (long a, long b)
 

Protected Member Functions

 PlanNode (PlanNodeId id, ArrayList< TupleId > tupleIds, String displayName)
 
 PlanNode (String displayName)
 
 PlanNode (PlanNodeId id, String displayName)
 
 PlanNode (PlanNodeId id, PlanNode node, String displayName)
 
void setDisplayName (String s)
 
final String getDisplayLabel ()
 
String getDisplayLabelDetail ()
 
final String getExplainString (String rootPrefix, String prefix, TExplainLevel detailLevel)
 
String getNodeExplainString (String rootPrefix, String detailPrefix, TExplainLevel detailLevel)
 
String getOffsetExplainString (String prefix)
 
void assignConjuncts (Analyzer analyzer)
 
ExprSubstitutionMap getCombinedChildSmap ()
 
void createDefaultSmap (Analyzer analyzer)
 
void computeStats (Analyzer analyzer)
 
long capAtLimit (long cardinality)
 
void markSlotsMaterialized (Analyzer analyzer, List< Expr > exprs)
 
void computeMemLayout (Analyzer analyzer)
 
double computeSelectivity ()
 
abstract void toThrift (TPlanNode msg)
 
String debugString ()
 
String getExplainString (List<?extends Expr > exprs)
 
boolean hasValidStats ()
 

Protected Attributes

String displayName_
 
PlanNodeId id_
 
long limit_
 
ArrayList< TupleIdtupleIds_
 
ArrayList< TupleIdtblRefIds_
 
Set< TupleIdnullableTupleIds_ = Sets.newHashSet()
 
List< Exprconjuncts_ = Lists.newArrayList()
 
PlanFragment fragment_
 
ExprSubstitutionMap outputSmap_
 
Set< ExprIdassignedConjuncts_
 
long cardinality_
 
int numNodes_
 
float avgRowSize_
 
long perHostMemCost_ = -1
 

Static Protected Attributes

static final int DEFAULT_BATCH_SIZE = 1024
 

Private Member Functions

void treeToThriftHelper (TPlan container)
 

Static Private Attributes

static final Logger LOG = LoggerFactory.getLogger(PlanNode.class)
 

Detailed Description

Each PlanNode represents a single relational operator and encapsulates the information needed by the planner to make optimization decisions.

finalize(): Computes internal state, such as keys for scan nodes; gets called once on the root of the plan tree before the call to toThrift(). Also finalizes the set of conjuncts, such that each remaining one requires all of its referenced slots to be materialized (ie, can be evaluated by calling GetValue(), rather than being implicitly evaluated as part of a scan key).

conjuncts_: Each node has a list of conjuncts that can be executed in the context of this node, ie, they only reference tuples materialized by this node or one of its children (= are bound by tupleIds_).

Definition at line 59 of file PlanNode.java.

Constructor & Destructor Documentation

Member Function Documentation

static long com.cloudera.impala.planner.PlanNode.addCardinalities ( long  a,
long  b 
)
inlinestatic
void com.cloudera.impala.planner.PlanNode.addConjuncts ( List< Expr conjuncts)
inline

Definition at line 209 of file PlanNode.java.

void com.cloudera.impala.planner.PlanNode.computeCosts ( TQueryOptions  queryOptions)
inline

Estimates the cost of executing this PlanNode. Currently only sets perHostMemCost_. May only be called after this PlanNode has been placed in a PlanFragment because the cost computation is dependent on the enclosing fragment's data partition.

Definition at line 562 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.perHostMemCost_.

void com.cloudera.impala.planner.PlanNode.computeStats ( Analyzer  analyzer)
inlineprotected

Computes planner statistics: avgRowSize_, numNodes_, cardinality_. Subclasses need to override this. Assumes that it has already been called on all children. and that DescriptorTable.computePhysMemLayout() has been called. This is broken out of init() so that it can be called separately from init() (to facilitate inserting additional nodes during plan partitioning w/o the need to call init() recursively on the whole tree again).

Definition at line 441 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.avgRowSize_, com.cloudera.impala.planner.PlanNode.numNodes_, and com.cloudera.impala.planner.PlanNode.tupleIds_.

Referenced by com.cloudera.impala.planner.PlanNode.init().

void com.cloudera.impala.planner.PlanNode.createDefaultSmap ( Analyzer  analyzer)
inlineprotected
String com.cloudera.impala.planner.PlanNode.debugString ( )
inlineprotected
Set<ExprId> com.cloudera.impala.planner.PlanNode.getAssignedConjuncts ( )
inline
ExprSubstitutionMap com.cloudera.impala.planner.PlanNode.getCombinedChildSmap ( )
inlineprotected
List<Expr> com.cloudera.impala.planner.PlanNode.getConjuncts ( )
inline
String com.cloudera.impala.planner.PlanNode.getDisplayLabelDetail ( )
inlineprotected

Subclasses can override to provide a node specific detail string that is displayed to the user. e.g. scan can return the table name.

Definition at line 234 of file PlanNode.java.

Referenced by com.cloudera.impala.planner.PlanNode.treeToThriftHelper().

final String com.cloudera.impala.planner.PlanNode.getExplainString ( String  rootPrefix,
String  prefix,
TExplainLevel  detailLevel 
)
inlineprotected
String com.cloudera.impala.planner.PlanNode.getExplainString ( List<?extends Expr exprs)
inlineprotected

Definition at line 506 of file PlanNode.java.

long com.cloudera.impala.planner.PlanNode.getInputCardinality ( )
inline

The input cardinality is the sum of output cardinalities of its children. For scan nodes the input cardinality is the expected number of rows scanned.

Definition at line 570 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.addCardinalities().

long com.cloudera.impala.planner.PlanNode.getLimit ( )
inline
String com.cloudera.impala.planner.PlanNode.getNodeExplainString ( String  rootPrefix,
String  detailPrefix,
TExplainLevel  detailLevel 
)
inlineprotected

Return the node-specific details. Subclass should override this function. Each line should be prefix by detailPrefix.

Definition at line 325 of file PlanNode.java.

Referenced by com.cloudera.impala.planner.PlanNode.getExplainString().

Set<TupleId> com.cloudera.impala.planner.PlanNode.getNullableTupleIds ( )
inline
String com.cloudera.impala.planner.PlanNode.getOffsetExplainString ( String  prefix)
inlineprotected

Return the offset_ details, if applicable. This is available separately from 'getNodeExplainString' because we want to output 'limit: ...' (which can be printed from PlanNode) before 'offset: ...', which is only printed from SortNodes right now.

Definition at line 336 of file PlanNode.java.

Referenced by com.cloudera.impala.planner.PlanNode.getExplainString().

ExprSubstitutionMap com.cloudera.impala.planner.PlanNode.getOutputSmap ( )
inline

Definition at line 178 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.outputSmap_.

long com.cloudera.impala.planner.PlanNode.getPerHostMemCost ( )
inline
ArrayList<TupleId> com.cloudera.impala.planner.PlanNode.getTblRefIds ( )
inline
boolean com.cloudera.impala.planner.PlanNode.hasValidStats ( )
inlineprotected
void com.cloudera.impala.planner.PlanNode.init ( Analyzer  analyzer) throws InternalException
inline

Computes the full internal state, including smap and planner-relevant statistics (calls computeStats()), marks all slots referenced by this node as materialized and computes the mem layout of all materialized tuples (with the assumption that slots that are needed by ancestor PlanNodes have already been marked). Also performs final expr substitution with childrens' smaps and computes internal state required for toThrift(). This is called directly after construction.

Definition at line 392 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.assignConjuncts(), com.cloudera.impala.planner.PlanNode.computeStats(), and com.cloudera.impala.planner.PlanNode.createDefaultSmap().

boolean com.cloudera.impala.planner.PlanNode.isBlockingNode ( )
inline

Returns true if this plan node can output its first row only after consuming all rows of all its children. This method is used to group plan nodes into pipelined units for resource estimation.

Definition at line 555 of file PlanNode.java.

Referenced by com.cloudera.impala.planner.PipelinedPlanNodeSet.computePlanNodeSets().

void com.cloudera.impala.planner.PlanNode.markSlotsMaterialized ( Analyzer  analyzer,
List< Expr exprs 
)
inlineprotected

Marks all slots referenced in exprs as materialized.

Definition at line 464 of file PlanNode.java.

Referenced by com.cloudera.impala.planner.HdfsScanNode.init().

static long com.cloudera.impala.planner.PlanNode.multiplyCardinalities ( long  a,
long  b 
)
inlinestatic

Computes and returns the product of two cardinalities. If an overflow occurs, the maximum Long value is returned (Long.MAX_VALUE).

Definition at line 541 of file PlanNode.java.

Referenced by com.cloudera.impala.planner.CrossJoinNode.computeStats(), and com.cloudera.impala.planner.HashJoinNode.getJoinCardinality().

void com.cloudera.impala.planner.PlanNode.setAssignedConjuncts ( Set< ExprId conjuncts)
inline
void com.cloudera.impala.planner.PlanNode.setDisplayName ( String  s)
inlineprotected

Definition at line 223 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.displayName_.

void com.cloudera.impala.planner.PlanNode.setFragment ( PlanFragment  fragment)
inline

Definition at line 175 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.fragment_.

void com.cloudera.impala.planner.PlanNode.setId ( PlanNodeId  id)
inline

Definition at line 165 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.id_.

void com.cloudera.impala.planner.PlanNode.setLimit ( long  limit)
inline

Set the limit_ to the given limit_ only if the limit_ hasn't been set, or the new limit_ is lower.

Parameters
limit_

Definition at line 190 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.limit_.

void com.cloudera.impala.planner.PlanNode.setOutputSmap ( ExprSubstitutionMap  smap)
inline

Definition at line 179 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.outputSmap_.

void com.cloudera.impala.planner.PlanNode.setTblRefIds ( ArrayList< TupleId ids)
inline

Definition at line 202 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.tblRefIds_.

abstract void com.cloudera.impala.planner.PlanNode.toThrift ( TPlanNode  msg)
abstractprotected
void com.cloudera.impala.planner.PlanNode.transferConjuncts ( PlanNode  recipient)
inline

Definition at line 214 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.conjuncts_.

TPlan com.cloudera.impala.planner.PlanNode.treeToThrift ( )
inline
void com.cloudera.impala.planner.PlanNode.unsetLimit ( )
inline

Definition at line 194 of file PlanNode.java.

References com.cloudera.impala.planner.PlanNode.limit_.

Member Data Documentation

final int com.cloudera.impala.planner.PlanNode.DEFAULT_BATCH_SIZE = 1024
staticprotected

Definition at line 63 of file PlanNode.java.

PlanNodeId com.cloudera.impala.planner.PlanNode.id_
protected
final Logger com.cloudera.impala.planner.PlanNode.LOG = LoggerFactory.getLogger(PlanNode.class)
staticprivate

Definition at line 60 of file PlanNode.java.

Set<TupleId> com.cloudera.impala.planner.PlanNode.nullableTupleIds_ = Sets.newHashSet()
protected
ArrayList<TupleId> com.cloudera.impala.planner.PlanNode.tblRefIds_
protected

The documentation for this class was generated from the following file: