Package org.apache.pig.experimental.logical.relational

Examples of org.apache.pig.experimental.logical.relational.LOGenerate


        LogicalExpressionPlan p2 = new LogicalExpressionPlan();       
        new ProjectExpression(p2, DataType.BAG, 1, 0);
        eps.add(p1);
        eps.add(p2);
       
        LOGenerate gen = new LOGenerate(innerPlan, eps, new boolean[] {false, true});
        innerPlan.add(gen);
        innerPlan.connect(l1, gen);
        innerPlan.connect(l2, gen);
       
        foreach2.setInnerPlan(innerPlan);     
View Full Code Here


       
        boolean flatten[] = new boolean[2];
        flatten[0] = false;
        flatten[1] = true;
       
        LOGenerate generate = new LOGenerate(innerPlan, expPlans, flatten);       
        innerPlan.add(generate);
        innerPlan.connect(innerLoad, generate);
        innerPlan.connect(innerLoad2, generate);
       
        foreach.setInnerPlan(innerPlan);
View Full Code Here

       
        boolean flatten[] = new boolean[2];
        flatten[0] = false;
        flatten[1] = true;
       
        LOGenerate generate = new LOGenerate(innerPlan, expPlans, flatten);       
        innerPlan.add(generate);
        innerPlan.connect(innerLoad, generate);
        innerPlan.connect(innerLoad2, generate);
       
        foreach.setInnerPlan(innerPlan);
View Full Code Here

       
        boolean flatten[] = new boolean[2];
        flatten[0] = false;
        flatten[1] = true;
       
        LOGenerate generate = new LOGenerate(innerPlan, expPlans, flatten);       
        innerPlan.add(generate);
        innerPlan.connect(innerLoad, generate);
        innerPlan.connect(innerLoad2, generate);
       
        foreach.setInnerPlan(innerPlan);
View Full Code Here

       
        boolean flatten[] = new boolean[2];
        flatten[0] = false;
        flatten[1] = true;
       
        LOGenerate generate = new LOGenerate(innerPlan, expPlans, flatten);       
        innerPlan.add(generate);
        innerPlan.connect(innerLoad, generate);
        innerPlan.connect(innerLoad2, generate);
       
        foreach.setInnerPlan(innerPlan);
View Full Code Here

       
        boolean flatten[] = new boolean[2];
        flatten[0] = false;
        flatten[1] = true;
       
        LOGenerate generate = new LOGenerate(innerPlan, expPlans, flatten);       
        innerPlan.add(generate);
        innerPlan.connect(innerLoad, generate);
        innerPlan.connect(innerLoad2, generate);
       
        foreach.setInnerPlan(innerPlan);
View Full Code Here

       
        boolean flatten[] = new boolean[2];
        flatten[0] = false;
        flatten[1] = false;
       
        LOGenerate generate = new LOGenerate(innerPlan, expPlans, flatten);       
        innerPlan.add(generate);
        innerPlan.connect(innerLoad, generate);
        innerPlan.connect(innerLoad2, generate);
       
        foreach.setInnerPlan(innerPlan);
View Full Code Here

                        LogicalPlan innerPlan = new LogicalPlan();
                        foreach.setInnerPlan(innerPlan);
                       
                        // build foreach inner plan
                        List<LogicalExpressionPlan> exps = new ArrayList<LogicalExpressionPlan>();             
                        LOGenerate gen = new LOGenerate(innerPlan, exps, new boolean[requiredFields.getFields().size()]);
                        innerPlan.add(gen);
                       
                        for (int i=0; i<requiredFields.getFields().size(); i++) {
                            LoadPushDown.RequiredField rf = requiredFields.getFields().get(i);
                            LOInnerLoad innerLoad = new LOInnerLoad(innerPlan, foreach, rf.getIndex());
View Full Code Here

                Set<Long> input = (Set<Long>)foreach.getAnnotation(ColumnPruneHelper.INPUTUIDS);
                LogicalRelationalOperator op = (LogicalRelationalOperator)foreach.getPlan().getPredecessors(foreach).get(0);
                Set<Integer> cols = columnHelper.getColumns(op.getSchema(), input);
               
                LogicalPlan innerPlan = foreach.getInnerPlan();
                LOGenerate gen = (LOGenerate)innerPlan.getSinks().get(0);
                           
                // clean up the predecessors of LOGenerate
                List<Operator> ll = innerPlan.getPredecessors(gen);
                List<Operator> toRemove = new ArrayList<Operator>();
                for(int i=0; i<ll.size(); i++) {
                   
                    // if the LOInnerLoads for this subplan are all in the column set,
                    // no change required, keep going
                    if (checkInnerLoads((LogicalRelationalOperator)ll.get(i), cols)) {
                        continue;
                    }        
                                      
                    // clean up and adjust expression plans
                    Iterator<LogicalExpressionPlan> iter = gen.getOutputPlans().iterator();
                    int j=-1;
                    while(iter.hasNext()) {
                        j++;
                        LogicalExpressionPlan exp = iter.next();
                        List<Operator> sinks = exp.getSinks();
                        for(Operator s: sinks) {
                            if (s instanceof ProjectExpression) {
                                int inputNo = ((ProjectExpression)s).getInputNum();
                                if (inputNo + toRemove.size() == i) {
                                    // if this expression has this input that is to be removed,
                                    // then remove this expression plan
                                    iter.remove();
                                   
                                    // adjust flatten flags
                                    boolean[] flatten = gen.getFlattenFlags();
                                    for(int k=j; k<flatten.length-1; k++) {
                                        flatten[k] = flatten[k+1];
                                    }
                                    break;
                                } else if (inputNo + toRemove.size() > i) {
                                    // adjust input number for all projections whose
                                    // input number is after the one to be removed
                                    ((ProjectExpression)s).setInputNum(inputNo-1);
                                }
                            }
                        }
                    }
                   
                    // this LOInnerLoad and its successors should be removed, add to the remove list
                    toRemove.add(ll.get(i));
                                       
                }
               
                for(Operator pred: toRemove) {
                    removeSubTree((LogicalRelationalOperator)pred);
                }
               
                // trim the flatten flags in case some expressions are removed
                boolean[] flatten = new boolean[gen.getOutputPlans().size()];
                System.arraycopy(gen.getFlattenFlags(), 0, flatten, 0, flatten.length);
                gen.setFlattenFlags(flatten);
            }
View Full Code Here

        @SuppressWarnings("unchecked")
        public void visitLOForEach(LOForEach foreach) throws IOException {
            Set<Long> output = setOutputUids(foreach);
           
            LogicalPlan innerPlan = foreach.getInnerPlan();
            LOGenerate gen = (LOGenerate)innerPlan.getSinks().get(0);
            gen.annotate(OUTPUTUIDS, output);
           
            ColumnDependencyVisitor v = new ColumnDependencyVisitor(innerPlan);           
            v.visit();
           
            Set<Long> input = new HashSet<Long>();
View Full Code Here

TOP

Related Classes of org.apache.pig.experimental.logical.relational.LOGenerate

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.