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

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


    public void visit(LOLesserThanEqual op) throws VisitorException {
        ExpressionOperator left = op.getLhsOperand();
        ExpressionOperator right = op.getRhsOperand();
               
        LessThanEqualExpression eq = new LessThanEqualExpression
        (exprPlan, exprOpsMap.get(left), exprOpsMap.get(right));
        exprOpsMap.put(op, eq);
    }
View Full Code Here


        LogicalExpressionPlan filterPlan = new LogicalExpressionPlan();
        //  Generate a filter condition.
        LogicalExpression konst = new ConstantExpression( filterPlan, value);
        konst.setLocation( valLoc );
        UserFuncExpression udf = new UserFuncExpression( filterPlan, new FuncSpec( RANDOM.class.getName() ) );
        new LessThanEqualExpression( filterPlan, udf, konst );
        LOFilter filter = new LOFilter( plan );
        return buildFilterOp( loc, filter, alias, inputAlias, filterPlan );
    }
View Full Code Here

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

        LessThanEqualExpression lesser1 = new LessThanEqualExpression(plan, constant1, constant2);
        BinCondExpression bincond1 = new BinCondExpression(plan, lesser1, constant3, constant4);

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

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

        // Induction check
        assertEquals(DataType.BOOLEAN, lesser1.getType());
        assertEquals(DataType.DOUBLE, bincond1.getType());

        // Cast insertion check
        assertEquals(DataType.FLOAT, lesser1.getLhs().getType());
        assertEquals(DataType.FLOAT, lesser1.getRhs().getType());
        assertEquals(DataType.DOUBLE, bincond1.getLhs().getType());
        assertEquals(DataType.DOUBLE, bincond1.getRhs().getType());

    }
View Full Code Here

        ConstantExpression constant2 = new ConstantExpression(plan, new DateTime(1L));
        ConstantExpression constant3 = new ConstantExpression(plan, new DateTime(2L));
        ConstantExpression constant4 = new ConstantExpression(plan, new DataByteArray("1970-01-01T00:00:00.003Z"));

        LessThanExpression lt1 = new LessThanExpression(plan, constant1, constant2);
        LessThanEqualExpression lte1 = new LessThanEqualExpression(plan, constant1, constant2);
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, constant3, constant4);
        GreaterThanEqualExpression gte1 = new GreaterThanEqualExpression(plan, constant3, constant4);
        EqualExpression eq1 = new EqualExpression(plan, constant0, constant1);
        NotEqualExpression neq1 = new NotEqualExpression(plan, constant0, constant2);

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

        plan.explain(System.out, "text", true);

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

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

        // Induction check
        assertEquals(DataType.BOOLEAN, lt1.getType());
        assertEquals(DataType.BOOLEAN, lte1.getType());
        assertEquals(DataType.BOOLEAN, gt1.getType());
        assertEquals(DataType.BOOLEAN, gte1.getType());
        assertEquals(DataType.BOOLEAN, eq1.getType());
        assertEquals(DataType.BOOLEAN, neq1.getType());
View Full Code Here

            // Create expression inner plan #2
            LogicalExpressionPlan innerPlan2 = new LogicalExpressionPlan();
            ProjectExpression project21 = new ProjectExpression(innerPlan2, 0, 0, splitOutput2);

            ConstantExpression const21 = new ConstantExpression(innerPlan2, 26L);
            LessThanEqualExpression lesser21 = new LessThanEqualExpression(innerPlan2, project21, const21);


            splitOutput1.setFilterPlan(innerPlan1);
            splitOutput2.setFilterPlan(innerPlan2);
View Full Code Here

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

        LessThanEqualExpression lesser1 = new LessThanEqualExpression(plan, constant1, constant2) ;
        BinCondExpression bincond1 = new BinCondExpression(plan, lesser1, constant3, constant4) ;

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

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

        // Induction check
        assertEquals(DataType.BOOLEAN, lesser1.getType()) ;
        assertEquals(DataType.DOUBLE, bincond1.getType()) ;

        // Cast insertion check
        assertEquals(DataType.FLOAT, lesser1.getLhs().getType()) ;
        assertEquals(DataType.FLOAT, lesser1.getRhs().getType()) ;
        assertEquals(DataType.DOUBLE, bincond1.getLhs().getType()) ;
        assertEquals(DataType.DOUBLE, bincond1.getRhs().getType()) ;

    }
View Full Code Here

        ConstantExpression constant2 = new ConstantExpression(plan, new DateTime(1L));
        ConstantExpression constant3 = new ConstantExpression(plan, new DateTime(2L));
        ConstantExpression constant4 = new ConstantExpression(plan, new DataByteArray("1970-01-01T00:00:00.003Z"));

        LessThanExpression lt1 = new LessThanExpression(plan, constant1, constant2);
        LessThanEqualExpression lte1 = new LessThanEqualExpression(plan, constant1, constant2);
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, constant3, constant4);
        GreaterThanEqualExpression gte1 = new GreaterThanEqualExpression(plan, constant3, constant4);
        EqualExpression eq1 = new EqualExpression(plan, constant0, constant1);
        NotEqualExpression neq1 = new NotEqualExpression(plan, constant0, constant2);

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

        plan.explain(System.out, "text", true);

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

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

        // Induction check
        assertEquals(DataType.BOOLEAN, lt1.getType());
        assertEquals(DataType.BOOLEAN, lte1.getType());
        assertEquals(DataType.BOOLEAN, gt1.getType());
        assertEquals(DataType.BOOLEAN, gte1.getType());
        assertEquals(DataType.BOOLEAN, eq1.getType());
        assertEquals(DataType.BOOLEAN, neq1.getType());
View Full Code Here

            // Create expression inner plan #2
            LogicalExpressionPlan innerPlan2 = new LogicalExpressionPlan() ;
            ProjectExpression project21 = new ProjectExpression(innerPlan2, 0, 0, splitOutput2) ;
           
            ConstantExpression const21 = new ConstantExpression(innerPlan2, 26L) ;
            LessThanEqualExpression lesser21 = new LessThanEqualExpression(innerPlan2, project21, const21) ;


            splitOutput1.setFilterPlan(innerPlan1);
            splitOutput2.setFilterPlan(innerPlan2);
View Full Code Here

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

        LessThanEqualExpression lesser1 = new LessThanEqualExpression(plan, constant1, constant2);
        BinCondExpression bincond1 = new BinCondExpression(plan, lesser1, constant3, constant4);

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

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

        // Induction check
        assertEquals(DataType.BOOLEAN, lesser1.getType());
        assertEquals(DataType.DOUBLE, bincond1.getType());

        // Cast insertion check
        assertEquals(DataType.FLOAT, lesser1.getLhs().getType());
        assertEquals(DataType.FLOAT, lesser1.getRhs().getType());
        assertEquals(DataType.DOUBLE, bincond1.getLhs().getType());
        assertEquals(DataType.DOUBLE, bincond1.getRhs().getType());

    }
View Full Code Here

        ConstantExpression constant2 = new ConstantExpression(plan, new DateTime(1L));
        ConstantExpression constant3 = new ConstantExpression(plan, new DateTime(2L));
        ConstantExpression constant4 = new ConstantExpression(plan, new DataByteArray("1970-01-01T00:00:00.003Z"));

        LessThanExpression lt1 = new LessThanExpression(plan, constant1, constant2);
        LessThanEqualExpression lte1 = new LessThanEqualExpression(plan, constant1, constant2);
        GreaterThanExpression gt1 = new GreaterThanExpression(plan, constant3, constant4);
        GreaterThanEqualExpression gte1 = new GreaterThanEqualExpression(plan, constant3, constant4);
        EqualExpression eq1 = new EqualExpression(plan, constant0, constant1);
        NotEqualExpression neq1 = new NotEqualExpression(plan, constant0, constant2);

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

        plan.explain(System.out, "text", true);

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

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

        // Induction check
        assertEquals(DataType.BOOLEAN, lt1.getType());
        assertEquals(DataType.BOOLEAN, lte1.getType());
        assertEquals(DataType.BOOLEAN, gt1.getType());
        assertEquals(DataType.BOOLEAN, gte1.getType());
        assertEquals(DataType.BOOLEAN, eq1.getType());
        assertEquals(DataType.BOOLEAN, neq1.getType());
View Full Code Here

TOP

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

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.