org.apache.pig.impl.plan.optimizer
Class Transformer<O extends Operator,P extends OperatorPlan<O>>

java.lang.Object
  extended by org.apache.pig.impl.plan.PlanVisitor<O,P>
      extended by org.apache.pig.impl.plan.optimizer.Transformer<O,P>
Direct Known Subclasses:
LogicalTransformer

public abstract class Transformer<O extends Operator,P extends OperatorPlan<O>>
extends PlanVisitor<O,P>

Transformer represents one tranform that the optimizer can apply to a graph. This class is a special case of a PlanVisitor,so it can navigate the plan.


Field Summary
 
Fields inherited from class org.apache.pig.impl.plan.PlanVisitor
mCurrentWalker, mPlan
 
Constructor Summary
protected Transformer(P plan, PlanWalker<O,P> walker)
           
 
Method Summary
abstract  boolean check(List<O> nodes)
          check if the transform should be done.
abstract  void transform(List<O> nodes)
          Transform the tree
 
Methods inherited from class org.apache.pig.impl.plan.PlanVisitor
getPlan, popWalker, pushWalker, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Transformer

protected Transformer(P plan,
                      PlanWalker<O,P> walker)
Parameters:
plan - OperatorPlan to be optimized.
Method Detail

check

public abstract boolean check(List<O> nodes)
                       throws OptimizerException
check if the transform should be done. If this is being called then the pattern matches, but there may be other criteria that must be met as well.

Parameters:
nodes - - List of nodes declared in transform ($1 = nodes[0], etc.) Remember that somes entries in node[] may be NULL since they may not be created until after the transform.
Returns:
true if the transform should be done.
Throws:
OptimizerException

transform

public abstract void transform(List<O> nodes)
                        throws OptimizerException
Transform the tree

Parameters:
nodes - - List of nodes declared in transform ($1 = nodes[0], etc.) This call must destruct any nodes that are being removed as part of the transform and remove them from the nodes vector and construct any that are being created as part of the transform and add them at the appropriate point to the nodes vector.
Throws:
OptimizerException


Copyright © ${year} The Apache Software Foundation