org.apache.hadoop.hive.ql.lib
Class DefaultGraphWalker

java.lang.Object
  extended by org.apache.hadoop.hive.ql.lib.DefaultGraphWalker
All Implemented Interfaces:
GraphWalker
Direct Known Subclasses:
ColumnPruner.ColumnPrunerWalker, ForwardWalker, GenMapRedWalker, GenTezWorkWalker, PreOrderWalker, TezWalker

public class DefaultGraphWalker
extends Object
implements GraphWalker

base class for operator graph walker this class takes list of starting ops and walks them one by one. it maintains list of walked operators (dispatchedList) and a list of operators that are discovered but not yet dispatched


Constructor Summary
DefaultGraphWalker(Dispatcher disp)
          Constructor.
 
Method Summary
 void dispatch(Node nd, Stack<Node> ndStack)
          Dispatch the current operator.
<T> T
dispatchAndReturn(Node nd, Stack<Node> ndStack)
          Returns dispatch result
 Set<Node> getDispatchedList()
           
 List<Node> getToWalk()
           
 void startWalking(Collection<Node> startNodes, HashMap<Node,Object> nodeOutput)
          starting point for walking.
 void walk(Node nd)
          walk the current operator and its descendants.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultGraphWalker

public DefaultGraphWalker(Dispatcher disp)
Constructor.

Parameters:
disp - dispatcher to call for each op encountered
Method Detail

getToWalk

public List<Node> getToWalk()
Returns:
the toWalk

getDispatchedList

public Set<Node> getDispatchedList()
Returns:
the doneList

dispatch

public void dispatch(Node nd,
                     Stack<Node> ndStack)
              throws SemanticException
Dispatch the current operator.

Parameters:
nd - node being walked
ndStack - stack of nodes encountered
Throws:
SemanticException

dispatchAndReturn

public <T> T dispatchAndReturn(Node nd,
                               Stack<Node> ndStack)
                    throws SemanticException
Returns dispatch result

Throws:
SemanticException

startWalking

public void startWalking(Collection<Node> startNodes,
                         HashMap<Node,Object> nodeOutput)
                  throws SemanticException
starting point for walking.

Specified by:
startWalking in interface GraphWalker
Parameters:
startNodes - list of starting operators
nodeOutput - If this parameter is not null, the call to the function returns the map from node to objects returned by the processors.
Throws:
SemanticException

walk

public void walk(Node nd)
          throws SemanticException
walk the current operator and its descendants.

Parameters:
nd - current operator in the graph
Throws:
SemanticException


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