org.apache.pig.experimental.plan
Interface OperatorPlan

All Known Implementing Classes:
BaseOperatorPlan, LogicalExpressionPlan, LogicalPlan, OperatorSubPlan

public interface OperatorPlan


Method Summary
 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.
 Pair<Integer,Integer> disconnect(Operator from, Operator to)
          Disconnect two operators in the plan.
 Iterator<Operator> getOperators()
          Get an iterator of all operators in this plan
 List<Operator> getPredecessors(Operator op)
          For a given operator, get all operators immediately before it in the plan.
 List<Operator> getSinks()
          Get all operators in the plan that have no successors.
 List<Operator> getSources()
          Get all operators in the plan that have no predecessors.
 List<Operator> getSuccessors(Operator op)
          For a given operator, get all operators immediately after it.
 boolean isEqual(OperatorPlan other)
          This is like a shallow comparison.
 void remove(Operator op)
          Remove an operator from the plan.
 int size()
          Get number of nodes in the plan.
 

Method Detail

size

int size()
Get number of nodes in the plan.


getSources

List<Operator> getSources()
Get all operators in the plan that have no predecessors.

Returns:
all operators in the plan that have no predecessors, or an empty list if the plan is empty.

getSinks

List<Operator> getSinks()
Get all operators in the plan that have no successors.

Returns:
all operators in the plan that have no successors, or an empty list if the plan is empty.

getPredecessors

List<Operator> getPredecessors(Operator op)
                               throws IOException
For a given operator, get all operators immediately before it in the plan.

Parameters:
op - operator to fetch predecessors of
Returns:
list of all operators immediately before op, or an empty list if op is a root.
Throws:
IOException - if op is not in the plan.

getSuccessors

List<Operator> getSuccessors(Operator op)
                             throws IOException
For a given operator, get all operators immediately after it.

Parameters:
op - operator to fetch successors of
Returns:
list of all operators immediately after op, or an empty list if op is a leaf.
Throws:
IOException - if op is not in the plan.

add

void add(Operator op)
Add a new operator to the plan. It will not be connected to any existing operators.

Parameters:
op - operator to add

remove

void remove(Operator op)
            throws IOException
Remove an operator from the plan.

Parameters:
op - Operator to be removed
Throws:
IOException - if the remove operation attempts to remove an operator that is still connected to other operators.

connect

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.

Parameters:
from - Operator edge will come from
fromPos - Position in the array for the from edge
to - Operator edge will go to
toPos - Position in the array for the to edge

connect

void connect(Operator from,
             Operator to)
Connect two operators in the plan.

Parameters:
from - Operator edge will come from
to - Operator edge will go to

disconnect

Pair<Integer,Integer> disconnect(Operator from,
                                 Operator to)
                                 throws IOException
Disconnect two operators in the plan.

Parameters:
from - Operator edge is coming from
to - Operator edge is going to
Returns:
pair of positions, indicating the position in the from and to arrays.
Throws:
IOException - if the two operators aren't connected.

getOperators

Iterator<Operator> getOperators()
Get an iterator of all operators in this plan

Returns:
an iterator of all operators in this plan

isEqual

boolean isEqual(OperatorPlan other)
This is like a shallow comparison. Two plans are equal if they have equivalent operators and equivalent structure.

Parameters:
other - object to compare
Returns:
boolean if both the plans are equivalent


Copyright © ${year} The Apache Software Foundation