Package org.apache.pig.impl.plan

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


    public void testDuplicateSchema2() {
        try {
            buildPlan(" a = load '1.txt' as (a0:int, a1:int);");
            LogicalPlan lp = buildPlan(" b = foreach a generate a0, a1 as a0;");
            SchemaAliasValidator schemaAliasValidator = new SchemaAliasValidator() ;
            CompilationMessageCollector collector = new CompilationMessageCollector() ;
            schemaAliasValidator.validate(lp, collector);
        } catch (PlanValidationException e) {
            assertTrue(e.getCause().getMessage().contains("Duplicate schema"));
            return;
        }
View Full Code Here


        String inputfile = generateTempFile().getAbsolutePath() ;
        String outputfile = generateNonExistenceTempFile().getAbsolutePath() ;

        LogicalPlan plan = genNewLoadStorePlan(inputfile, outputfile, ctx.getFs()) ;       
       
        CompilationMessageCollector collector = new CompilationMessageCollector() ;       
        boolean isBeforeOptimizer = false; // we are not optimizing in this testcase
        LogicalPlanValidationExecutor executor = new LogicalPlanValidationExecutor(plan, ctx, isBeforeOptimizer) ;
        executor.validate(plan, collector) ;
       
        assertFalse(collector.hasError()) ;

    }
View Full Code Here

        String inputfile = generateTempFile().getAbsolutePath() ;
        String outputfile = generateTempFile().getAbsolutePath() ;

        LogicalPlan plan = genNewLoadStorePlan(inputfile, outputfile, ctx.getDfs()) ;       
       
        CompilationMessageCollector collector = new CompilationMessageCollector() ;       
        boolean isBeforeOptimizer = false; // we are not optimizing in this testcase
        LogicalPlanValidationExecutor executor = new LogicalPlanValidationExecutor(plan, ctx, isBeforeOptimizer) ;
        try {
            executor.validate(plan, collector) ;
            fail("Expected to fail.");
        } catch (Exception pve) {
            //good
        }
       
        assertEquals(collector.size(), 3) ;
        for(int i = 0; i < collector.size(); ++i) {
            assertEquals(collector.get(i).getMessageType(), MessageType.Error) ;
        }       

    }
View Full Code Here

        String inputfile = createHadoopTempFile(ctx) ;
        String outputfile = createHadoopNonExistenceTempFile(ctx) ;

        LogicalPlan plan = genNewLoadStorePlan(inputfile, outputfile, ctx.getDfs()) ;                    
       
        CompilationMessageCollector collector = new CompilationMessageCollector() ;       
        boolean isBeforeOptimizer = false; // we are not optimizing in this testcase
        LogicalPlanValidationExecutor executor = new LogicalPlanValidationExecutor(plan, ctx, isBeforeOptimizer) ;
        executor.validate(plan, collector) ;
           
        assertFalse(collector.hasError()) ;

    }
View Full Code Here

        String inputfile = createHadoopTempFile(ctx) ;
        String outputfile = createHadoopTempFile(ctx) ;

        LogicalPlan plan = genNewLoadStorePlan(inputfile, outputfile, ctx.getDfs()) ;                    
       
        CompilationMessageCollector collector = new CompilationMessageCollector() ;       
        boolean isBeforeOptimizer = false; // we are not optimizing in this testcase
        LogicalPlanValidationExecutor executor = new LogicalPlanValidationExecutor(plan, ctx, isBeforeOptimizer) ;
        try {
            executor.validate(plan, collector) ;
            fail("Excepted to fail.");
        } catch(Exception e) {
            //good
        }
       
        assertEquals(collector.size(), 3) ;
        for(int i = 0; i < collector.size(); ++i) {
            assertEquals(collector.get(i).getMessageType(), MessageType.Error) ;
        }      

    }
View Full Code Here

          int errCode = 2053;
          String msg = "Internal error. Did not find roots in the physical plan.";
          throw new MRCompilerException(msg, errCode, PigException.BUG);
        }
        scope = roots.get(0).getOperatorKey().getScope();
        messageCollector = new CompilationMessageCollector() ;
        phyToMROpMap = new HashMap<PhysicalOperator, MapReduceOper>();
       
        fileConcatenationThreshold = Integer.parseInt(pigContext.getProperties()
                .getProperty(FILE_CONCATENATION_THRESHOLD, "100"));
        optimisticFileConcatenation = pigContext.getProperties().getProperty(
View Full Code Here

            lpt.buildPlan("a = load '" + inputFileName + "' as (c:chararray, " +
                    "i:int,d:double);");
            LogicalPlan lp = lpt.buildPlan("store a into '" + outputFileName +
                    "' using PigStorage();");
            InputOutputFileVisitor visitor = new InputOutputFileVisitor(lp,
                    new CompilationMessageCollector(), pig.getPigContext());
            visitor.visit();
        } catch (PlanValidationException pve){
            // Since output file is present, validation should fail
            // and throw this exception
            assertEquals(6000,pve.getErrorCode());
View Full Code Here

        plan.connect(constant2, add1) ;
        plan.connect(add1, mul1) ;
        plan.connect(constant3, cast1) ;
        plan.connect(cast1, mul1) ;
                         
        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingValidator typeValidator = new TypeCheckingValidator() ;
        typeValidator.validate(plan, collector) ;       
        printMessageCollector(collector) ;
        printTypeGraph(plan) ;
       
        if (collector.hasError()) {
            throw new Exception("Error during type checking") ;
        }      
       
        // Induction check
        assertEquals(DataType.DOUBLE, add1.getType()) ;
View Full Code Here

        plan.connect(constant2, add1) ;
        plan.connect(add1, mul1) ;
        plan.connect(constant3, cast1) ;
        plan.connect(cast1, mul1) ;
                         
        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 Exception("Error during type checking") ;
        }      
    }
View Full Code Here

   
    private CompilationMessageCollector messageCollector = null;

    public CombinerOptimizer(MROperPlan plan, String chunkSize) {
        super(plan, new DepthFirstWalker<MapReduceOper, MROperPlan>(plan));
        messageCollector = new CompilationMessageCollector() ;
    }
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.