public abstract class BaseOperatorPlan extends java.lang.Object implements OperatorPlan, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected PlanEdge |
fromEdges |
protected static org.apache.commons.logging.Log |
log |
protected java.util.List<Operator> |
ops |
protected PlanEdge |
softFromEdges |
protected PlanEdge |
softToEdges |
protected PlanEdge |
toEdges |
Constructor and Description |
---|
BaseOperatorPlan() |
BaseOperatorPlan(BaseOperatorPlan other) |
Modifier and Type | Method and Description |
---|---|
void |
add(Operator op)
Add a new operator to the plan.
|
void |
connect(Operator from,
int fromPos,
Operator to,
int toPos)
Connect two operators in the plan, controlling which position in the
edge lists that the from and to edges are placed.
|
void |
connect(Operator from,
Operator to)
Connect two operators in the plan.
|
void |
createSoftLink(Operator from,
Operator to)
Create an soft edge between two nodes.
|
Pair<java.lang.Integer,java.lang.Integer> |
disconnect(Operator from,
Operator to)
Disconnect two operators in the plan.
|
void |
explain(java.io.PrintStream ps,
java.lang.String format,
boolean verbose) |
java.util.Iterator<Operator> |
getOperators()
Get an iterator of all operators in this plan
|
java.util.List<Operator> |
getPredecessors(Operator op)
For a given operator, get all operators immediately before it in the
plan.
|
java.util.List<Operator> |
getSinks()
Get all operators in the plan that have no successors.
|
java.util.List<Operator> |
getSoftLinkPredecessors(Operator op)
For a given operator, get all operators softly immediately before it in the
plan.
|
java.util.List<Operator> |
getSoftLinkSuccessors(Operator op)
For a given operator, get all operators softly immediately after it.
|
java.util.List<Operator> |
getSources()
Get all operators in the plan that have no predecessors.
|
java.util.List<Operator> |
getSuccessors(Operator op)
For a given operator, get all operators immediately after it.
|
void |
insertBetween(Operator pred,
Operator operatorToInsert,
Operator succ)
This method insert node operatorToInsert between pred and succ.
|
boolean |
isConnected(Operator from,
Operator to)
Check if given two operators are directly connected.
|
boolean |
isEqual(OperatorPlan other)
This is like a shallow comparison.
|
protected static boolean |
isEqual(OperatorPlan p1,
OperatorPlan p2) |
void |
moveTree(Operator root,
BaseOperatorPlan newPlan)
Move everything below a given operator to the new operator plan.
|
boolean |
pathExists(Operator from,
Operator to)
A method to check if there is a path from a given node to another node
|
void |
remove(Operator op)
Remove an operator from the plan.
|
void |
removeAndReconnect(Operator operatorToRemove)
This method remove a node operatorToRemove.
|
void |
removeSoftLink(Operator from,
Operator to)
Remove an soft edge
|
void |
replace(Operator oldOperator,
Operator newOperator)
This method replace the oldOperator with the newOperator, make all connection
to the new operator in the place of old operator
|
int |
size()
Get number of nodes in the plan.
|
java.lang.String |
toString() |
void |
trimBelow(Operator op)
Trim everything below a given operator.
|
protected java.util.List<Operator> ops
protected PlanEdge fromEdges
protected PlanEdge toEdges
protected PlanEdge softFromEdges
protected PlanEdge softToEdges
protected static final org.apache.commons.logging.Log log
public BaseOperatorPlan()
public BaseOperatorPlan(BaseOperatorPlan other)
public int size()
size
in interface OperatorPlan
public java.util.List<Operator> getSources()
getSources
in interface OperatorPlan
public java.util.List<Operator> getSinks()
getSinks
in interface OperatorPlan
public java.util.List<Operator> getPredecessors(Operator op)
getPredecessors
in interface OperatorPlan
op
- operator to fetch predecessors ofpublic java.util.List<Operator> getSuccessors(Operator op)
getSuccessors
in interface OperatorPlan
op
- operator to fetch successors ofpublic java.util.List<Operator> getSoftLinkPredecessors(Operator op)
getSoftLinkPredecessors
in interface OperatorPlan
op
- operator to fetch predecessors ofpublic java.util.List<Operator> getSoftLinkSuccessors(Operator op)
getSoftLinkSuccessors
in interface OperatorPlan
op
- operator to fetch successors ofpublic void add(Operator op)
add
in interface OperatorPlan
op
- operator to addpublic void remove(Operator op) throws FrontendException
remove
in interface OperatorPlan
op
- Operator to be removedFrontendException
- if the remove operation attempts to
remove an operator that is still connected to other operators.public void connect(Operator from, int fromPos, Operator to, int toPos)
connect
in interface OperatorPlan
from
- Operator edge will come fromfromPos
- Position in the array for the from edgeto
- Operator edge will go totoPos
- Position in the array for the to edgepublic boolean isConnected(Operator from, Operator to)
from
- Operator edge will come fromto
- Operator edge will go topublic void connect(Operator from, Operator to)
connect
in interface OperatorPlan
from
- Operator edge will come fromto
- Operator edge will go topublic void createSoftLink(Operator from, Operator to)
createSoftLink
in interface OperatorPlan
from
- Operator dependent uponto
- Operator having the dependencypublic void removeSoftLink(Operator from, Operator to)
removeSoftLink
in interface OperatorPlan
from
- Operator dependent uponto
- Operator having the dependencypublic Pair<java.lang.Integer,java.lang.Integer> disconnect(Operator from, Operator to) throws FrontendException
disconnect
in interface OperatorPlan
from
- Operator edge is coming fromto
- Operator edge is going toFrontendException
- if the two operators aren't connected.public java.util.Iterator<Operator> getOperators()
OperatorPlan
getOperators
in interface OperatorPlan
public boolean isEqual(OperatorPlan other) throws FrontendException
OperatorPlan
isEqual
in interface OperatorPlan
other
- object to compareFrontendException
protected static boolean isEqual(OperatorPlan p1, OperatorPlan p2) throws FrontendException
FrontendException
public void explain(java.io.PrintStream ps, java.lang.String format, boolean verbose) throws FrontendException
FrontendException
public java.lang.String toString()
toString
in class java.lang.Object
public void replace(Operator oldOperator, Operator newOperator) throws FrontendException
OperatorPlan
replace
in interface OperatorPlan
oldOperator
- operator to be replacednewOperator
- operator to replaceFrontendException
public void removeAndReconnect(Operator operatorToRemove) throws FrontendException
OperatorPlan
removeAndReconnect
in interface OperatorPlan
operatorToRemove
- operator to removeFrontendException
public void insertBetween(Operator pred, Operator operatorToInsert, Operator succ) throws FrontendException
OperatorPlan
insertBetween
in interface OperatorPlan
pred
- predecessor of inserted node after this methodoperatorToInsert
- operato to insertsucc
- successor of inserted node after this methodFrontendException
public boolean pathExists(Operator from, Operator to)
pathExists
in interface OperatorPlan
from
- the start node for checkingto
- the end node for checkingpublic void moveTree(Operator root, BaseOperatorPlan newPlan) throws FrontendException
root
- Operator to move everything afternewPlan
- new operator plan to move things intoPlanException
FrontendException
public void trimBelow(Operator op) throws FrontendException
op
- Operator to trim everything after.FrontendException
Copyright © 2007-2017 The Apache Software Foundation