org.apache.hadoop.hive.ql.ppd
Class ExprWalkerInfo

java.lang.Object
  extended by org.apache.hadoop.hive.ql.ppd.ExprWalkerInfo
All Implemented Interfaces:
NodeProcessorCtx

public class ExprWalkerInfo
extends Object
implements NodeProcessorCtx

Context for Expression Walker for determining predicate pushdown candidates It contains a ExprInfo object for each expression that is processed.


Constructor Summary
ExprWalkerInfo()
           
ExprWalkerInfo(Operator<? extends OperatorDesc> op, RowResolver toRR)
           
 
Method Summary
 void addAlias(ExprNodeDesc expr, String alias)
          Adds the specified alias to the specified expr.
 void addConvertedNode(ExprNodeDesc oldNode, ExprNodeDesc newNode)
          adds a replacement node for this expression.
 void addFinalCandidate(ExprNodeDesc expr)
          Adds the specified expr as the top-most pushdown expr (ie all its children can be pushed).
 void addNonFinalCandidate(ExprNodeDesc expr)
          Adds the specified expr as a non-final candidate
 void addPushDowns(String alias, List<ExprNodeDesc> pushDowns)
          Adds the passed list of pushDowns for the alias.
 String getAlias(ExprNodeDesc expr)
          Returns the alias of the specified expr.
 ExprNodeDesc getConvertedNode(Node nd)
           
 Map<String,List<ExprNodeDesc>> getFinalCandidates()
          Returns the list of pushdown expressions for each alias that appear in the current operator's RowResolver.
 Map<ExprNodeDesc,ExprNodeDesc> getNewToOldExprMap()
           
 Map<String,List<ExprNodeDesc>> getNonFinalCandidates()
          Returns list of non-final candidate predicate for each map.
 Operator<? extends OperatorDesc> getOp()
           
 Map<String,List<ExprNodeDesc>> getResidualPredicates(boolean clear)
           
 RowResolver getToRR()
           
 boolean isCandidate(ExprNodeDesc expr)
          Returns true if the specified expression is pushdown candidate else false.
 boolean isDeterministic()
           
 void merge(ExprWalkerInfo ewi)
          Merges the specified pushdown predicates with the current class.
 void setDeterministic(boolean b)
          sets the deterministic flag for this expression.
 void setIsCandidate(ExprNodeDesc expr, boolean b)
          Marks the specified expr to the specified value.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExprWalkerInfo

public ExprWalkerInfo()

ExprWalkerInfo

public ExprWalkerInfo(Operator<? extends OperatorDesc> op,
                      RowResolver toRR)
Method Detail

getOp

public Operator<? extends OperatorDesc> getOp()
Returns:
the op of this expression.

getToRR

public RowResolver getToRR()
Returns:
the row resolver of the operator of this expression.

getNewToOldExprMap

public Map<ExprNodeDesc,ExprNodeDesc> getNewToOldExprMap()
Returns:
the new expression to old expression map

getConvertedNode

public ExprNodeDesc getConvertedNode(Node nd)
Returns:
converted expression for give node. If there is none then returns null.

addConvertedNode

public void addConvertedNode(ExprNodeDesc oldNode,
                             ExprNodeDesc newNode)
adds a replacement node for this expression.

Parameters:
oldNode - original node
newNode - new node

isCandidate

public boolean isCandidate(ExprNodeDesc expr)
Returns true if the specified expression is pushdown candidate else false.

Parameters:
expr -
Returns:
true or false

setIsCandidate

public void setIsCandidate(ExprNodeDesc expr,
                           boolean b)
Marks the specified expr to the specified value.

Parameters:
expr -
b - can

getAlias

public String getAlias(ExprNodeDesc expr)
Returns the alias of the specified expr.

Parameters:
expr -
Returns:
The alias of the expression

addAlias

public void addAlias(ExprNodeDesc expr,
                     String alias)
Adds the specified alias to the specified expr.

Parameters:
expr -
alias -

addFinalCandidate

public void addFinalCandidate(ExprNodeDesc expr)
Adds the specified expr as the top-most pushdown expr (ie all its children can be pushed).

Parameters:
expr -

addPushDowns

public void addPushDowns(String alias,
                         List<ExprNodeDesc> pushDowns)
Adds the passed list of pushDowns for the alias.

Parameters:
alias -
pushDowns -

getFinalCandidates

public Map<String,List<ExprNodeDesc>> getFinalCandidates()
Returns the list of pushdown expressions for each alias that appear in the current operator's RowResolver. The exprs in each list can be combined using conjunction (AND).

Returns:
the map of alias to a list of pushdown predicates

addNonFinalCandidate

public void addNonFinalCandidate(ExprNodeDesc expr)
Adds the specified expr as a non-final candidate

Parameters:
expr -

getNonFinalCandidates

public Map<String,List<ExprNodeDesc>> getNonFinalCandidates()
Returns list of non-final candidate predicate for each map.

Returns:
list of non-final candidate predicates

getResidualPredicates

public Map<String,List<ExprNodeDesc>> getResidualPredicates(boolean clear)

merge

public void merge(ExprWalkerInfo ewi)
Merges the specified pushdown predicates with the current class.

Parameters:
ewi - ExpressionWalkerInfo

setDeterministic

public void setDeterministic(boolean b)
sets the deterministic flag for this expression.

Parameters:
b - deterministic or not

isDeterministic

public boolean isDeterministic()
Returns:
whether this expression is deterministic or not.


Copyright © 2014 The Apache Software Foundation. All rights reserved.