org.apache.pig.impl.logicalLayer.optimizer
Class StreamOptimizer

java.lang.Object
  extended by org.apache.pig.impl.plan.PlanVisitor<O,P>
      extended by org.apache.pig.impl.plan.optimizer.Transformer<LogicalOperator,LogicalPlan>
          extended by org.apache.pig.impl.logicalLayer.optimizer.LogicalTransformer
              extended by org.apache.pig.impl.logicalLayer.optimizer.StreamOptimizer

public class StreamOptimizer
extends LogicalTransformer

A visitor to optimize in the following scenario with streaming: Optimize when LOAD precedes STREAM and the loader class is the same as the serializer for the STREAM. Similarly optimize when STREAM is followed by store and the deserializer class is same as the Storage class. Specifically in both these cases the optimization is to replace the loader/serializer with BinaryStorage which just moves bytes around and likewise replace the storer/deserializer with BinaryStorage


Field Summary
 
Fields inherited from class org.apache.pig.impl.plan.PlanVisitor
mCurrentWalker, mPlan
 
Constructor Summary
StreamOptimizer(LogicalPlan plan, String operatorClassName)
           
 
Method Summary
 boolean check(List<LogicalOperator> nodes)
          check if the transform should be done.
 void reset()
          Reset any internal state after the transformation.
 void transform(List<LogicalOperator> nodes)
          Transform the tree
 
Methods inherited from class org.apache.pig.impl.logicalLayer.optimizer.LogicalTransformer
fixUpContainedPlans, insertAfter, insertBetween, rebuildProjectionMaps, rebuildSchemas
 
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

StreamOptimizer

public StreamOptimizer(LogicalPlan plan,
                       String operatorClassName)
Method Detail

check

public boolean check(List<LogicalOperator> nodes)
              throws OptimizerException
Description copied from class: Transformer
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.

Specified by:
check in class Transformer<LogicalOperator,LogicalPlan>
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 void transform(List<LogicalOperator> nodes)
               throws OptimizerException
Description copied from class: Transformer
Transform the tree

Specified by:
transform in class Transformer<LogicalOperator,LogicalPlan>
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

reset

public void reset()
Description copied from class: Transformer
Reset any internal state after the transformation.

Overrides:
reset in class LogicalTransformer


Copyright © ${year} The Apache Software Foundation