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

java.lang.Object
  extended by org.apache.pig.impl.plan.optimizer.Transformer<LogicalOperator,LogicalPlan>
      extended by org.apache.pig.impl.logicalLayer.optimizer.LogicalTransformer
Direct Known Subclasses:
ImplicitSplitInserter, OpLimitOptimizer, PartitionFilterOptimizer, PruneColumns, PushDownForeachFlatten, PushUpFilter, TypeCastInserter

public abstract class LogicalTransformer
extends Transformer<LogicalOperator,LogicalPlan>


Field Summary
 
Fields inherited from class org.apache.pig.impl.plan.optimizer.Transformer
mPlan
 
Constructor Summary
protected LogicalTransformer(LogicalPlan plan)
           
 
Method Summary
protected  void fixUpContainedPlans(LogicalOperator after, LogicalOperator newNode, LogicalOperator before, Map<Integer,Integer> projectionMapping)
          Once a node has been inserted, inner plans associated with other nodes may have references to the node that has been replaced or moved.
protected  void insertAfter(LogicalOperator after, LogicalOperator newNode, Map<Integer,Integer> projectionMapping)
          Insert a node in after an existing nodes.
protected  void insertBetween(LogicalOperator after, LogicalOperator newNode, LogicalOperator before, Map<Integer,Integer> projectionMapping)
          Insert a node in between two existing nodes.
protected  void rebuildProjectionMaps()
          Rebuild projection maps after a rule has transformed the tree.
protected  void rebuildSchemas()
          Rebuild schemas after a rule has transformed the tree.
 void reset()
          Reset any internal state after the transformation.
 
Methods inherited from class org.apache.pig.impl.plan.optimizer.Transformer
check, getPlan, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogicalTransformer

protected LogicalTransformer(LogicalPlan plan)
Method Detail

rebuildSchemas

protected void rebuildSchemas()
                       throws VisitorException,
                              FrontendException
Rebuild schemas after a rule has transformed the tree. This will first null out existing schemas and then call getSchema to rebuild them.

Throws:
VisitorException, - FrontendException
VisitorException
FrontendException

rebuildProjectionMaps

protected void rebuildProjectionMaps()
                              throws VisitorException
Rebuild projection maps after a rule has transformed the tree. This will first null out existing projection maps and then call getProjectionMap to rebuild them.

Throws:
VisitorException

insertBetween

protected void insertBetween(LogicalOperator after,
                             LogicalOperator newNode,
                             LogicalOperator before,
                             Map<Integer,Integer> projectionMapping)
                      throws VisitorException,
                             FrontendException
Insert a node in between two existing nodes. This includes inserting the node into the correct place in the plan and finding any projects in successors and reconnecting them to the new node as well as rebuilding all of the schemas.

Parameters:
after - Node to insert the new node after
newNode - New node to insert
before - Node to insert this node before
projectionMapping - A map that defines how projections in after relate to projections in newnode. Keys are the projection offsets in after, values are the new offsets in newnode. If this field is null, then it will be assumed that the mapping is 1-1.
Throws:
VisitorException, - FrontendException
VisitorException
FrontendException

fixUpContainedPlans

protected void fixUpContainedPlans(LogicalOperator after,
                                   LogicalOperator newNode,
                                   LogicalOperator before,
                                   Map<Integer,Integer> projectionMapping)
                            throws VisitorException,
                                   FrontendException
Once a node has been inserted, inner plans associated with other nodes may have references to the node that has been replaced or moved. This function walks those inner plans and patches up references.

Parameters:
after - Node that has had a new node inserted after it.
newNode - node that has been inserted
before - Node that has had a new node inserted before it.
projectionMapping - A map that defines how projections in after relate to projections in newNode. Keys are the projection offsets in after, values are the new offsets in newNode. If this field is null, then it will be assumed that the mapping is 1-1.
Throws:
VisitorException, - FrontendException
VisitorException
FrontendException

insertAfter

protected void insertAfter(LogicalOperator after,
                           LogicalOperator newNode,
                           Map<Integer,Integer> projectionMapping)
                    throws VisitorException,
                           FrontendException
Insert a node in after an existing nodes. This includes inserting the node into the correct place in the plan and finding any projects in successors and reconnecting them to the new node as well as rebuilding all of the schemas. This function assumes that the node has only one predecessor.

Parameters:
after - Node to insert the new node after
newNode - New node to insert
projectionMapping - A map that defines how projections in after relate to projections in newnode. Keys are the projection offsets in after, values are the new offsets in newnode. If this field is null, then it will be assumed that the mapping is 1-1.
Throws:
VisitorException, - FrontendException
VisitorException
FrontendException

reset

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

Specified by:
reset in class Transformer<LogicalOperator,LogicalPlan>


Copyright © ${year} The Apache Software Foundation