org.apache.pig.impl.plan
Class PlanDumper<E extends Operator,P extends OperatorPlan<E>,S extends OperatorPlan<? extends Operator>>

java.lang.Object
  extended by org.apache.pig.impl.plan.PlanDumper<E,P,S>
Direct Known Subclasses:
DotPlanDumper

public class PlanDumper<E extends Operator,P extends OperatorPlan<E>,S extends OperatorPlan<? extends Operator>>
extends Object

This class dumps a nested plan to a print stream. It does not walk the graph in any particular fashion it merely iterates over all operators and edges and calls a corresponding dump function. If a node of the plan has nested plans this will be dumped when the node is handled.


Field Summary
protected  boolean isVerbose
           
protected  P plan
           
protected  PrintStream ps
           
 
Constructor Summary
PlanDumper(P plan, PrintStream ps)
           
 
Method Summary
 void dump()
          This is the public interface.
protected  void dumpEdge(Operator op, Operator suc)
          Will be called to dump the edges of the plan.
protected  void dumpMultiInputNestedOperator(E op, MultiMap<E,S> plans)
          Will be called when an operator has nested plans, which are connected to one of the multiple inputs.
protected  void dumpMultiOutputNestedOperator(E op, Collection<S> plans)
          Will be called for nested operators, where the plans represent how the output of the operator is processed.
protected  void dumpNestedOperator(E op, Collection<S> plans)
          Will be called for nested operators.
protected  void dumpOperator(E op)
          Will be called to dump a simple operator
protected  MultiMap<E,S> getMultiInputNestedPlans(E op)
          Used to determine if an operator has nested plans, which are connected to specific input operators.
protected  Collection<S> getMultiOutputNestedPlans(E op)
          Used to determine if an operator has nested output plans
protected  Collection<S> getNestedPlans(E op)
          Used to determine if an operator has nested plans (without connections to in- or output operators.
 boolean isVerbose()
           
protected  void join(String sep, String[] strings)
          Helper function to print a string array.
protected  PlanDumper makeDumper(S plan, PrintStream ps)
          makeDumper is a factory method.
 void setVerbose(boolean verbose)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ps

protected PrintStream ps

plan

protected P extends OperatorPlan<E> plan

isVerbose

protected boolean isVerbose
Constructor Detail

PlanDumper

public PlanDumper(P plan,
                  PrintStream ps)
Method Detail

setVerbose

public void setVerbose(boolean verbose)

isVerbose

public boolean isVerbose()

dump

public void dump()
This is the public interface. Dump writes the plan and nested plans to the stream.


makeDumper

protected PlanDumper makeDumper(S plan,
                                PrintStream ps)
makeDumper is a factory method. Used by subclasses to specify what dumper should handle the nested plan.

Parameters:
plan - Plan that the new dumper should handle
Returns:
the dumper for plan

dumpOperator

protected void dumpOperator(E op)
Will be called to dump a simple operator

Parameters:
op - the operator to be dumped

dumpMultiInputNestedOperator

protected void dumpMultiInputNestedOperator(E op,
                                            MultiMap<E,S> plans)
Will be called when an operator has nested plans, which are connected to one of the multiple inputs.

Parameters:
op - the nested operator
plans - a map of input operator to connected nested plan

dumpMultiOutputNestedOperator

protected void dumpMultiOutputNestedOperator(E op,
                                             Collection<S> plans)
Will be called for nested operators, where the plans represent how the output of the operator is processed.

Parameters:
op - the nested operator
plans - a collection of sub plans.

dumpNestedOperator

protected void dumpNestedOperator(E op,
                                  Collection<S> plans)
Will be called for nested operators. The operators are not specifically connected to any input or output operators of E

Parameters:
op - the nested operator
plans - a collection of sub plans.

dumpEdge

protected void dumpEdge(Operator op,
                        Operator suc)
Will be called to dump the edges of the plan. Each edge results in one call.

Parameters:
op - tail of the edge
suc - head of the edge

getMultiInputNestedPlans

protected MultiMap<E,S> getMultiInputNestedPlans(E op)
Used to determine if an operator has nested plans, which are connected to specific input operators.

Parameters:
op - operator
Returns:
Map describing the input to nested plan relationship.

getMultiOutputNestedPlans

protected Collection<S> getMultiOutputNestedPlans(E op)
Used to determine if an operator has nested output plans

Parameters:
op - operator
Returns:
Map describing the input to nested plan relationship.

getNestedPlans

protected Collection<S> getNestedPlans(E op)
Used to determine if an operator has nested plans (without connections to in- or output operators.

Parameters:
op - operator
Returns:
Collection of nested plans.

join

protected void join(String sep,
                    String[] strings)
Helper function to print a string array.

Parameters:
sep - Separator
strings - Array to print


Copyright © 2007-2012 The Apache Software Foundation