Package org.apache.pig.experimental.plan

Examples of org.apache.pig.experimental.plan.Operator


            subPlan = new OperatorSubPlan(currentPlan);

            LOJoin join = (LOJoin)matched.getSources().get(0);
            subPlan.add(join);    
           
            Operator next = matched.getSinks().get(0);
            while(next != null && next instanceof LOFilter) {
                LOFilter filter = (LOFilter)next;               
                subPlan.add(filter);
               
                LogicalExpressionPlan filterPlan = filter.getFilterPlan();
               
                // collect all uids used in the filter plan
                Set<Long> uids = new HashSet<Long>();
                Iterator<Operator> iter = filterPlan.getOperators();
                while(iter.hasNext()) {
                    Operator op = iter.next();
                    if (op instanceof ProjectExpression) {
                        long uid = ((ProjectExpression)op).getUid();
                        uids.add(uid);
                    }
                }
               
                // find the farthest predecessor that has all the fields
                LogicalRelationalOperator input = join;
                List<Operator> preds = currentPlan.getPredecessors(input);
                while(preds != null) {               
                    boolean found = false;
                    for(int j=0; j<preds.size(); j++) {
                        if (hasAll((LogicalRelationalOperator)preds.get(j), uids)) {
                            input = (LogicalRelationalOperator)preds.get(j);  
                            subPlan.add(input);
                            found = true;
                            break;
                        }
                    }
                    if (!found) {
                        break;
                    }
                    preds = currentPlan.getPredecessors(input);
                }
                           
                if (input != join) {                          
                    Operator pred = currentPlan.getPredecessors(filter).get(0);
                    Operator succed = currentPlan.getSuccessors(filter).get(0);
                    subPlan.add(succed);
                   
                    Pair<Integer, Integer> p1 = currentPlan.disconnect(pred, filter);
                    Pair<Integer, Integer> p2 = currentPlan.disconnect(filter, succed);
                    currentPlan.connect(pred, p1.first, succed, p2.second);
View Full Code Here

TOP

Related Classes of org.apache.pig.experimental.plan.Operator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.