MCPcopy Create free account
hub / github.com/apache/pig / OperatorSubPlan

Class OperatorSubPlan

src/org/apache/pig/newplan/OperatorSubPlan.java:38–206  ·  view source on GitHub ↗

Class to represent a view of a plan. The view contains a subset of the plan. All the operators returned from the view are the same objects to the operators in its base plan. It is used to represent match results.

Source from the content-addressed store, hash-verified

36 *
37 */
38public class OperatorSubPlan implements OperatorPlan {
39
40 private OperatorPlan basePlan;
41 private List<Operator> roots;
42 private List<Operator> leaves;
43 private Set<Operator> operators;
44
45 public OperatorSubPlan(OperatorPlan base) {
46 basePlan = base;
47 roots = new ArrayList<Operator>();
48 leaves = new ArrayList<Operator>();
49 operators = new HashSet<Operator>();
50 }
51
52 public OperatorPlan getBasePlan() {
53 return basePlan;
54 }
55
56 @Override
57 public void add(Operator op) {
58 operators.add(op);
59 leaves.clear();
60 roots.clear();
61 }
62
63 @Override
64 public void connect(Operator from, int fromPos, Operator to, int toPos) {
65 throw new UnsupportedOperationException("connect() can not be called on OperatorSubPlan");
66 }
67
68 @Override
69 public void connect(Operator from, Operator to) {
70 throw new UnsupportedOperationException("connect() can not be called on OperatorSubPlan");
71 }
72
73 @Override
74 public Pair<Integer, Integer> disconnect(Operator from, Operator to) throws FrontendException {
75 throw new UnsupportedOperationException("disconnect() can not be called on OperatorSubPlan");
76 }
77
78 @Override
79 public List<Operator> getSinks() {
80 if (leaves.size() == 0 && operators.size() > 0) {
81 for (Operator op : operators) {
82 if (getSuccessors(op) == null) {
83 leaves.add(op);
84 }
85 }
86 }
87 return leaves;
88 }
89
90 @Override
91 public Iterator<Operator> getOperators() {
92 return operators.iterator();
93 }
94
95 @Override

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected