Package org.apache.pig.newplan.logical.expression

Examples of org.apache.pig.newplan.logical.expression.GreaterThanExpression


        ConstantExpression constant2 =  new ConstantExpression(plan,  new DataByteArray()) ;
        ConstantExpression constant3 =  new ConstantExpression(plan,  123L) ;
        ConstantExpression constant4 =  new ConstantExpression(plan,  true) ;

        SubtractExpression sub1 = new SubtractExpression(plan, constant1, constant2) ;
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, sub1, constant3) ;
        AndExpression and1 = new AndExpression(plan, gt1, constant4) ;
        NotExpression not1 = new NotExpression(plan, and1) ;

        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
        expTypeChecker.visit();


        printMessageCollector(collector) ;
        //printTypeGraph(plan) ;

        if (collector.hasError()) {
            throw new Exception("Error not expected during type checking") ;
        }      


        // Induction check  
        assertEquals(DataType.INTEGER, sub1.getType()) ;   
        assertEquals(DataType.BOOLEAN, gt1.getType()) ;    
        assertEquals(DataType.BOOLEAN, and1.getType()) ;   
        assertEquals(DataType.BOOLEAN, not1.getType()) ;   

        // Cast insertion check    
        assertEquals(DataType.INTEGER, sub1.getRhs().getType()) ;   
        assertEquals(DataType.LONG, gt1.getLhs().getType()) ;

    }
View Full Code Here


        LogicalExpressionPlan plan = new LogicalExpressionPlan() ;
        ConstantExpression constant1 = new ConstantExpression(plan, 10) ;
        ConstantExpression constant2 =  new ConstantExpression(plan, 20D) ;
        ConstantExpression constant3 =  new ConstantExpression(plan, 123L) ;

        GreaterThanExpression gt1 = new GreaterThanExpression(plan, constant1, constant2) ;
        EqualExpression equal1 = new EqualExpression(plan, gt1, constant3) ;

        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        LogicalRelationalOperator dummyRelOp = createDummyRelOpWithAlias();
        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, dummyRelOp);
View Full Code Here

  //          project1.setSentinel(true);
            ProjectExpression project2 = new ProjectExpression(innerPlan, 0, 1, filter1);
                //new ProjectExpression(innerPlan, load1, 1) ;
            //project2.setSentinel(true);

            GreaterThanExpression gt1 = new GreaterThanExpression(innerPlan, project1, project2);
           
            plan.add(load1);
            plan.add(filter1);
            plan.connect(load1, filter1) ;
View Full Code Here

TOP

Related Classes of org.apache.pig.newplan.logical.expression.GreaterThanExpression

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.