org.apache.pig.impl.logicalLayer.optimizer
Class LogicalTransformer
java.lang.Object
org.apache.pig.impl.plan.PlanVisitor<O,P>
org.apache.pig.impl.plan.optimizer.Transformer<LogicalOperator,LogicalPlan>
org.apache.pig.impl.logicalLayer.optimizer.LogicalTransformer
- Direct Known Subclasses:
- ImplicitSplitInserter, OpLimitOptimizer, StreamOptimizer, TypeCastInserter
public abstract class LogicalTransformer
- extends Transformer<LogicalOperator,LogicalPlan>
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 |
rebuildSchemas()
Rebuild schemas after a rule has transformed the tree. |
protected void |
removeFromChain(LogicalOperator nodeToRemove,
Map<Integer,Integer> projectionMapping)
Remove a node in the middle of a linear chain. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LogicalTransformer
protected LogicalTransformer(LogicalPlan plan,
PlanWalker<LogicalOperator,LogicalPlan> walker)
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
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 afternewNode
- New node to insertbefore
- Node to insert this node beforeprojectionMapping
- 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 insertedbefore
- 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 afternewNode
- New node to insertprojectionMapping
- 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
removeFromChain
protected void removeFromChain(LogicalOperator nodeToRemove,
Map<Integer,Integer> projectionMapping)
throws VisitorException,
FrontendException
- Remove a node in the middle of a linear chain. This includes removing the node
from the plan and reconnect the nodes before and after the node as well as rebuilding
all of the schemas. This node should have one and only one predecessor and zero or one
successor
- Parameters:
nodeToRemove
- Node to removeprojectionMapping
- A map that defines how projections in after
relate to projections in nodeToRemove. Keys are the projection offsets in
after, values are the new offsets in nodeToRemove. If this field is null,
then it will be assumed that the mapping is 1-1.
- Throws:
VisitorException,
- FrontendException
VisitorException
FrontendException
Copyright © ${year} The Apache Software Foundation