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

Public Member Functions

 PlanFragment (PlanFragmentId id, PlanNode root, DataPartition partition)
 
void setOutputExprs (List< Expr > outputExprs)
 
List< ExprgetOutputExprs ()
 
void finalize (Analyzer analyzer) throws InternalException, NotImplementedException
 
int getNumNodes ()
 
long getNumDistinctValues (List< Expr > exprs)
 
TPlanFragment toThrift ()
 
String getExplainString (TExplainLevel explainLevel)
 
boolean isPartitioned ()
 
PlanFragmentId getId ()
 
PlanFragment getDestFragment ()
 
ExchangeNode getDestNode ()
 
DataPartition getDataPartition ()
 
void setDataPartition (DataPartition dataPartition)
 
DataPartition getOutputPartition ()
 
void setOutputPartition (DataPartition outputPartition)
 
PlanNode getPlanRoot ()
 
void setPlanRoot (PlanNode root)
 
void setDestination (ExchangeNode destNode)
 
boolean hasSink ()
 
DataSink getSink ()
 
void setSink (DataSink sink)
 
void addPlanRoot (PlanNode newRoot)
 

Private Member Functions

void setFragmentInPlanTree (PlanNode node)
 
boolean computeCanAddSlotFilters (PlanNode node)
 

Private Attributes

final PlanFragmentId fragmentId_
 
PlanNode planRoot_
 
ExchangeNode destNode_
 
List< ExproutputExprs_
 
DataSink sink_
 
DataPartition dataPartition_
 
DataPartition outputPartition_
 

Static Private Attributes

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

Detailed Description

A PlanFragment is part of a tree of such fragments that together make up a complete execution plan for a single query. Each plan fragment can have one or many instances, each of which in turn is executed by a single node and the output sent to a specific instance of the destination fragment (or, in the case of the root fragment, is materialized in some form).

The plan fragment encapsulates the specific tree of execution nodes that are used to produce the output of the plan fragment, as well as output exprs, destination node, etc. If there are no output exprs, the full row that is is produced by the plan root is marked as materialized.

A hash-partitioned plan fragment is the result of one or more hash-partitioning data streams being received by plan nodes in this fragment. In the future, a fragment's data partition could also be hash partitioned based on a scan node that is reading from a physically hash-partitioned table.

The sequence of calls is:

Definition at line 63 of file PlanFragment.java.

Constructor & Destructor Documentation

Member Function Documentation

void com.cloudera.impala.planner.PlanFragment.addPlanRoot ( PlanNode  newRoot)
inline

Adds a node as the new root to the plan tree. Connects the existing root as the child of newRoot.

Definition at line 355 of file PlanFragment.java.

References com.cloudera.impala.planner.PlanFragment.planRoot_.

boolean com.cloudera.impala.planner.PlanFragment.computeCanAddSlotFilters ( PlanNode  node)
inlineprivate

Returns true and sets node.canAddPredicate, if we can add single-slot filters at execution time (i.e. after Prepare() to the plan tree rooted at this node. That is, 'node' can add filters that can be evaluated at nodes below.

We compute this by walking the tree bottom up.

TODO: move this to PlanNode.init() which is normally responsible for computing internal state of PlanNodes. We cannot do this currently since we need the distrubutionMode() set on HashJoin nodes. Once we call init() properly for repartitioned joins, this logic can move to init().

Definition at line 195 of file PlanFragment.java.

References com.cloudera.impala.planner.ScanNode.desc_, com.cloudera.impala.analysis.JoinOperator.FULL_OUTER_JOIN, com.cloudera.impala.planner.HashJoinNode.getDistributionMode(), com.cloudera.impala.planner.HashJoinNode.getJoinOp(), com.cloudera.impala.catalog.HdfsTable.getMajorityFormat(), com.cloudera.impala.analysis.TupleDescriptor.getTable(), com.cloudera.impala.analysis.JoinOperator.LEFT_ANTI_JOIN, com.cloudera.impala.analysis.JoinOperator.LEFT_OUTER_JOIN, com.cloudera.impala.analysis.JoinOperator.NULL_AWARE_LEFT_ANTI_JOIN, com.cloudera.impala.catalog.HdfsFileFormat.PARQUET, and com.cloudera.impala.planner.HashJoinNode.DistributionMode.PARTITIONED.

Referenced by com.cloudera.impala.planner.PlanFragment.finalize().

void com.cloudera.impala.planner.PlanFragment.finalize ( Analyzer  analyzer) throws InternalException, NotImplementedException
inline

Finalize plan tree and create stream sink, if needed. If this fragment is hash partitioned, ensures that the corresponding partition exprs of all hash-partitioning senders are cast to identical types. Otherwise, the hashes generated for identical partition values may differ among senders if the partition-expr types are not identical.

Definition at line 128 of file PlanFragment.java.

References com.cloudera.impala.planner.PlanFragment.computeCanAddSlotFilters(), com.cloudera.impala.planner.PlanFragment.dataPartition_, com.cloudera.impala.planner.PlanFragment.destNode_, com.cloudera.impala.planner.DataPartition.getPartitionExprs(), com.cloudera.impala.planner.DataPartition.isHashPartitioned(), com.cloudera.impala.planner.PlanFragment.outputPartition_, com.cloudera.impala.planner.PlanFragment.planRoot_, and com.cloudera.impala.planner.PlanFragment.sink_.

DataPartition com.cloudera.impala.planner.PlanFragment.getDataPartition ( )
inline
PlanFragment com.cloudera.impala.planner.PlanFragment.getDestFragment ( )
inline
ExchangeNode com.cloudera.impala.planner.PlanFragment.getDestNode ( )
inline
String com.cloudera.impala.planner.PlanFragment.getExplainString ( TExplainLevel  explainLevel)
inline
PlanFragmentId com.cloudera.impala.planner.PlanFragment.getId ( )
inline
long com.cloudera.impala.planner.PlanFragment.getNumDistinctValues ( List< Expr exprs)
inline

Estimates the per-node number of distinct values of exprs based on the data partition of this fragment and its number of nodes. Returns -1 for an invalid estimate, e.g., because getNumDistinctValues() failed on one of the exprs.

Definition at line 254 of file PlanFragment.java.

References com.cloudera.impala.planner.PlanFragment.dataPartition_, com.cloudera.impala.planner.PlanFragment.getNumNodes(), and com.cloudera.impala.planner.DataPartition.getPartitionExprs().

int com.cloudera.impala.planner.PlanFragment.getNumNodes ( )
inline

Return the number of nodes on which the plan fragment will execute. invalid: -1

Definition at line 179 of file PlanFragment.java.

References com.cloudera.impala.planner.PlanFragment.dataPartition_.

Referenced by com.cloudera.impala.planner.PlanFragment.getNumDistinctValues().

List<Expr> com.cloudera.impala.planner.PlanFragment.getOutputExprs ( )
inline
DataPartition com.cloudera.impala.planner.PlanFragment.getOutputPartition ( )
inline
PlanNode com.cloudera.impala.planner.PlanFragment.getPlanRoot ( )
inline
DataSink com.cloudera.impala.planner.PlanFragment.getSink ( )
inline

Definition at line 343 of file PlanFragment.java.

References com.cloudera.impala.planner.PlanFragment.sink_.

boolean com.cloudera.impala.planner.PlanFragment.hasSink ( )
inline

Definition at line 342 of file PlanFragment.java.

References com.cloudera.impala.planner.PlanFragment.sink_.

void com.cloudera.impala.planner.PlanFragment.setDataPartition ( DataPartition  dataPartition)
inline

Definition at line 328 of file PlanFragment.java.

void com.cloudera.impala.planner.PlanFragment.setDestination ( ExchangeNode  destNode)
inline
void com.cloudera.impala.planner.PlanFragment.setFragmentInPlanTree ( PlanNode  node)
inlineprivate

Assigns 'this' as fragment of all PlanNodes in the plan tree rooted at node. Does not traverse the children of ExchangeNodes because those must belong to a different fragment.

Definition at line 106 of file PlanFragment.java.

Referenced by com.cloudera.impala.planner.PlanFragment.PlanFragment(), and com.cloudera.impala.planner.PlanFragment.setPlanRoot().

void com.cloudera.impala.planner.PlanFragment.setOutputExprs ( List< Expr outputExprs)
inline
void com.cloudera.impala.planner.PlanFragment.setOutputPartition ( DataPartition  outputPartition)
inline

Definition at line 332 of file PlanFragment.java.

void com.cloudera.impala.planner.PlanFragment.setPlanRoot ( PlanNode  root)
inline
void com.cloudera.impala.planner.PlanFragment.setSink ( DataSink  sink)
inline

Definition at line 344 of file PlanFragment.java.

TPlanFragment com.cloudera.impala.planner.PlanFragment.toThrift ( )
inline

Member Data Documentation

final PlanFragmentId com.cloudera.impala.planner.PlanFragment.fragmentId_
private
final Logger com.cloudera.impala.planner.PlanFragment.LOG = LoggerFactory.getLogger(PlanFragment.class)
staticprivate

Definition at line 64 of file PlanFragment.java.


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