Java Code Examples for org.apache.pig.impl.util.Utils#mergeCollection()
The following examples show how to use
org.apache.pig.impl.util.Utils#mergeCollection() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReverseDependencyOrderWalker.java From spork with Apache License 2.0 | 6 votes |
protected void doAllSuccessors(Operator node, Set<Operator> seen, Collection<Operator> fifo) throws FrontendException { if (!seen.contains(node)) { // We haven't seen this one before. Collection<Operator> succs = Utils.mergeCollection(plan.getSuccessors(node), plan.getSoftLinkSuccessors(node)); if (succs != null && succs.size() > 0) { // Do all our successors before ourself for (Operator op : succs) { doAllSuccessors(op, seen, fifo); } } // Now do ourself seen.add(node); fifo.add(node); } }
Example 2
Source File: DependencyOrderWalker.java From spork with Apache License 2.0 | 6 votes |
protected void doAllPredecessors(Operator node, Set<Operator> seen, Collection<Operator> fifo) throws FrontendException { if (!seen.contains(node)) { // We haven't seen this one before. Collection<Operator> preds = Utils.mergeCollection(plan.getPredecessors(node), plan.getSoftLinkPredecessors(node)); if (preds != null && preds.size() > 0) { // Do all our predecessors before ourself for (Operator op : preds) { doAllPredecessors(op, seen, fifo); } } // Now do ourself seen.add(node); fifo.add(node); } }
Example 3
Source File: ReverseDependencyOrderWalker.java From spork with Apache License 2.0 | 6 votes |
protected void doAllSuccessors(O node, Set<O> seen, Collection<O> fifo) throws VisitorException { if (!seen.contains(node)) { // We haven't seen this one before. Collection<O> succs = Utils.mergeCollection(mPlan.getSuccessors(node), mPlan.getSoftLinkSuccessors(node)); if (succs != null && succs.size() > 0) { // Do all our successors before ourself for (O op : succs) { doAllSuccessors(op, seen, fifo); } } // Now do ourself seen.add(node); fifo.add(node); } }
Example 4
Source File: DependencyOrderWalker.java From spork with Apache License 2.0 | 6 votes |
protected void doAllPredecessors(O node, Set<O> seen, Collection<O> fifo) throws VisitorException { if (!seen.contains(node)) { // We haven't seen this one before. Collection<O> preds = Utils.mergeCollection(mPlan.getPredecessors(node), mPlan.getSoftLinkPredecessors(node)); if (preds != null && preds.size() > 0) { // Do all our predecessors before ourself for (O op : preds) { doAllPredecessors(op, seen, fifo); } } // Now do ourself seen.add(node); fifo.add(node); } }
Example 5
Source File: PigRelOpWalker.java From calcite with Apache License 2.0 | 5 votes |
/** * Does post-order walk on the Pig logical relational plans from sinks to sources. * * @param root The root Pig logical relational operator * @param visitor The visitor of each Pig logical operator node * @throws FrontendException Exception during processing Pig operator */ private void postOrderWalk(Operator root, PlanPreVisitor visitor) throws FrontendException { if (root == null || visitor.preVisit((LogicalRelationalOperator) root)) { return; } Collection<Operator> nexts = Utils.mergeCollection(plan.getPredecessors(root), plan.getSoftLinkPredecessors(root)); if (nexts != null) { for (Operator op : nexts) { postOrderWalk(op, visitor); } } root.accept(visitor); }
Example 6
Source File: PigRelExWalker.java From calcite with Apache License 2.0 | 5 votes |
/** * Does post-order walk on the Pig expression plan from source to sinks. * * @param root The root expression operator * @param visitor The visitor of each Pig expression node. * @throws FrontendException Exception during processing Pig operator */ private void postOrderWalk(Operator root, PlanVisitor visitor) throws FrontendException { final Collection<Operator> nexts = Utils.mergeCollection(plan.getSuccessors(root), plan.getSuccessors(root)); if (nexts != null) { for (Operator op : nexts) { postOrderWalk(op, visitor); } } root.accept(visitor); }
Example 7
Source File: ReverseDependencyOrderWalkerWOSeenChk.java From spork with Apache License 2.0 | 5 votes |
protected void doAllSuccessors(Operator node, Collection<Operator> fifo) throws FrontendException { Collection<Operator> succs = Utils.mergeCollection(plan.getSuccessors(node), plan.getSoftLinkSuccessors(node)); if (succs != null && succs.size() > 0) { // Do all our successors before ourself for (Operator op : succs) { doAllSuccessors(op, fifo); } } // Now do ourself fifo.add(node); }
Example 8
Source File: DepthFirstWalker.java From spork with Apache License 2.0 | 5 votes |
private void depthFirst(Operator node, Collection<Operator> successors, Set<Operator> seen, PlanVisitor visitor) throws FrontendException { if (successors == null) return; for (Operator suc : successors) { if (seen.add(suc)) { suc.accept(visitor); Collection<Operator> newSuccessors = Utils.mergeCollection(plan.getSuccessors(suc), plan.getSoftLinkSuccessors(suc)); depthFirst(suc, newSuccessors, seen, visitor); } } }
Example 9
Source File: DepthFirstWalker.java From spork with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") private void depthFirst(O node, Collection<O> successors, Set<O> seen, PlanVisitor<O, P> visitor) throws VisitorException { if (successors == null) return; for (O suc : successors) { if (seen.add(suc)) { suc.visit(visitor); Collection<O> newSuccessors = Utils.mergeCollection(mPlan.getSuccessors(suc), mPlan.getSoftLinkSuccessors(suc)); depthFirst(suc, newSuccessors, seen, visitor); } } }
Example 10
Source File: PreOrderDepthFirstWalker.java From spork with Apache License 2.0 | 5 votes |
private void depthFirst(Operator node, Collection<Operator> predecessors, Set<Operator> seen, PlanVisitor visitor) throws FrontendException { if (predecessors == null) return; boolean thisBranchFlag = branchFlag; for (Operator pred : predecessors) { if (seen.add(pred)) { branchFlag = thisBranchFlag; pred.accept(visitor); Collection<Operator> newPredecessors = Utils.mergeCollection(plan.getPredecessors(pred), plan.getSoftLinkPredecessors(pred)); depthFirst(pred, newPredecessors, seen, visitor); } } }