Package org.apache.pig.newplan

Examples of org.apache.pig.newplan.Operator


                }

                @Override
                public void visit(OrExpression orExpr) throws FrontendException {
                    List<Operator> children = plan.getSuccessors(orExpr);
                    Operator lhs = children != null && children.size() > 0 ? children.get(0)
                                    : null, rhs = children != null && children.size() > 1 ? children.get(1)
                                    : null;
                    if ((lhs == null && rhs == null) || dnfTrimmed(orExpr)) {
                        remove(orExpr);
                    }
                    else if (rhs == null) {
                        trimOneChild(orExpr, lhs);
                        plan.remove(orExpr);
                    }
                }

                @Override
                public void visit(AndExpression andExpr)
                                throws FrontendException {
                    List<Operator> children = plan.getSuccessors(andExpr);
                    Operator lhs = children != null && children.size() > 0 ? children.get(0)
                                    : null, rhs = children != null && children.size() > 1 ? children.get(1)
                                    : null;
                    if ((lhs == null && rhs == null) || dnfTrimmed(andExpr)) {
                        remove(andExpr);
                    }
View Full Code Here


                }

                @Override
                public void visit(OrExpression orExpr) throws FrontendException {
                    List<Operator> children = plan.getSuccessors(orExpr);
                    Operator lhs = children != null && children.size() > 0 ? children.get(0)
                                    : null, rhs = children != null && children.size() > 1 ? children.get(1)
                                    : null;
                    if ((lhs == null && rhs == null) || dnfTrimmed(orExpr)) {
                        remove(orExpr);
                    }
View Full Code Here

                @Override
                public void visit(AndExpression andExpr)
                                throws FrontendException {
                    List<Operator> children = plan.getSuccessors(andExpr);
                    Operator lhs = children != null && children.size() > 0 ? children.get(0)
                                    : null, rhs = children != null && children.size() > 1 ? children.get(1)
                                    : null;
                    if ((lhs == null && rhs == null) || dnfTrimmed(andExpr)) {
                        remove(andExpr);
                    }
View Full Code Here

                plan.add(newExp);
                List<Operator> predList = plan.getPredecessors(parent);
                if (predList != null) {
                    Operator[] preds = predList.toArray(new Operator[0]);
                    for (Object p : preds) {
                        Operator pred = (Operator) p;
                        Pair<Integer, Integer> pos = plan.disconnect(pred, parent);
                        plan.connect(pred, pos.first, newExp, pos.second);
                    }
                }
                plan.remove(parent);
View Full Code Here

        lpt.buildPlan( "B = FOREACH A GENERATE name, flatten(cuisines);" );
        lpt.buildPlan( "C = FILTER B BY name == 'joe';" );
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = lpt.buildPlan( "D = STORE C INTO 'empty';" )
        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator filter = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator fe1 = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( fe1 instanceof LOForEach );
        Operator fe2 = newLogicalPlan.getSuccessors( fe1 ).get( 0 );
        Assert.assertTrue( fe2 instanceof LOForEach );
    }
View Full Code Here

        lpt.buildPlan( "C = FILTER B BY $1 == 'french';" );
        lpt.buildPlan( "D = FILTER C BY name == 'joe';" );
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = lpt.buildPlan( "E = STORE D INTO 'empty';" )
        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );
       
        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator filter = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator fe1 = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( fe1 instanceof LOForEach );
        Operator fe2 = newLogicalPlan.getSuccessors( fe1 ).get( 0 );
        Assert.assertTrue( fe2 instanceof LOForEach );
        Operator filter2 = newLogicalPlan.getSuccessors( fe2 ).get( 0 );
        Assert.assertTrue( filter2 instanceof LOFilter );
    }
View Full Code Here

        lpt.buildPlan( "C = FILTER B BY name == 'joe';" );
        lpt.buildPlan( "D = FILTER C BY age == 30;" );
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = lpt.buildPlan( "E = STORE D INTO 'empty';" )
        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );
       
        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator filter = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator filter2 = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( filter2 instanceof LOFilter );
        Operator fe1 = newLogicalPlan.getSuccessors( filter2 ).get( 0 );
        Assert.assertTrue( fe1 instanceof LOForEach );
        Operator fe2 = newLogicalPlan.getSuccessors( fe1 ).get( 0 );
        Assert.assertTrue( fe2 instanceof LOForEach );
    }
View Full Code Here

        lpt.buildPlan( "C = FILTER B BY $1 == 'French';" );
        lpt.buildPlan( "D = FILTER C BY $2 == 'Europe';" );
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = lpt.buildPlan( "E = STORE D INTO 'empty';" )
        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator fe1 = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( fe1 instanceof LOForEach );
        Operator fe2 = newLogicalPlan.getSuccessors( fe1 ).get( 0 );
        Assert.assertTrue( fe2 instanceof LOForEach );
        Operator filter = newLogicalPlan.getSuccessors( fe2 ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator filter2 = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( filter2 instanceof LOFilter );
    }
View Full Code Here

        lpt.buildPlan( "B = FOREACH A GENERATE name, flatten(cuisines);" );
        lpt.buildPlan( "C = FILTER B BY cuisine == 'French';" );
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = lpt.buildPlan( "D = STORE C INTO 'empty';" )
        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator fe1 = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( fe1 instanceof LOForEach );
        Operator fe2 = newLogicalPlan.getSuccessors( fe1 ).get( 0 );
        Assert.assertTrue( fe2 instanceof LOForEach );
        Operator filter = newLogicalPlan.getSuccessors( fe2 ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
    }
View Full Code Here

        lpt.buildPlan( "B = FOREACH A GENERATE name, cuisines;" );
        lpt.buildPlan( "C = FILTER B BY name == 'joe';" );
        org.apache.pig.impl.logicalLayer.LogicalPlan plan = lpt.buildPlan( "D = STORE C INTO 'empty';" )
        LogicalPlan newLogicalPlan = migrateAndOptimizePlan( plan );

        Operator load = newLogicalPlan.getSources().get( 0 );
        Assert.assertTrue( load instanceof LOLoad );
        Operator filter = newLogicalPlan.getSuccessors( load ).get( 0 );
        Assert.assertTrue( filter instanceof LOFilter );
        Operator fe1 = newLogicalPlan.getSuccessors( filter ).get( 0 );
        Assert.assertTrue( fe1 instanceof LOForEach );
        Operator fe2 = newLogicalPlan.getSuccessors( fe1 ).get( 0 );
        Assert.assertTrue( fe2 instanceof LOForEach );
    }
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.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.