Package org.apache.pig.impl.plan

Examples of org.apache.pig.impl.plan.CompilationMessageCollector


        planTester.buildPlan("a = load '1.txt' as (a0);");
        planTester.buildPlan("b = foreach a generate flatten((bag{tuple(map[])})a0) as b0:map[];");
        LogicalPlan plan = planTester.buildPlan("c = foreach b generate (long)b0#'key1';");

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
        planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here


        plan.add(load1) ;
        plan.add(foreach1) ;

        plan.connect(load1, foreach1);

        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        try {
            typeValidator.validate(plan, collector) ;
            fail("Exception expected") ;
        }
        catch (PlanValidationException pve) {
            // good
        }
        printMessageCollector(collector) ;
        printTypeGraph(plan) ;

        if (!collector.hasError()) {
            throw new AssertionError("Expect error") ;
        }

    }
View Full Code Here

        plan.add(load1) ;
        plan.add(foreach1) ;

        plan.connect(load1, foreach1);

        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        // check outer schema
        Schema endResultSchema = foreach1.getSchema() ;
View Full Code Here

        plan.connect(load1, cross);
        plan.connect(load2, cross);

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
View Full Code Here

    public void testLineage1() throws Throwable {
        planTester.buildPlan("a = load 'a' as (field1: int, field2: float, field3: chararray );") ;
        LogicalPlan plan = planTester.buildPlan("b = foreach a generate field1 + 1.0 ;") ;

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
        planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here

    public void testLineage1NoSchema() throws Throwable {
        planTester.buildPlan("a = load 'a';") ;
        LogicalPlan plan = planTester.buildPlan("b = foreach a generate $1 + 1.0 ;") ;

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
        planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here

    public void testLineage2() throws Throwable {
        planTester.buildPlan("a = load 'a' as (field1, field2: float, field3: chararray );") ;
        LogicalPlan plan = planTester.buildPlan("b = foreach a generate field1 + 1.0 ;") ;

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
        planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here

        planTester.buildPlan("b = group a by field1 ;") ;
        planTester.buildPlan("c = foreach b generate flatten(a) ;") ;
        LogicalPlan plan = planTester.buildPlan("d = foreach c generate field1 + 1.0 ;") ;

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here

        planTester.buildPlan("b = group a by $0 ;") ;
        planTester.buildPlan("c = foreach b generate flatten(a) ;") ;
        LogicalPlan plan = planTester.buildPlan("d = foreach c generate $0 + 1.0 ;") ;

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
        planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here

        planTester.buildPlan("a = load 'a' using BinStorage() as (field1, field2: float, field3: chararray );") ;
        planTester.buildPlan("b = group a by field1 ;") ;
        LogicalPlan plan = planTester.buildPlan("c = foreach b generate group + 1.0 ;") ;

        // validate
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;

        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
        planTester.printPlan(plan, TypeCheckingTestUtil.getCurrentMethodName());

        if (collector.hasError()) {
            throw new AssertionError("Expect no  error") ;
        }

        LOForEach foreach = (LOForEach)plan.getLeaves().get(0);
        LogicalPlan foreachPlan = foreach.getForEachPlans().get(0);
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.plan.CompilationMessageCollector

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.