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

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


    public void visit(LODivide binOp) throws VisitorException {
        ExpressionOperator left = binOp.getLhsOperand();
        ExpressionOperator right = binOp.getRhsOperand();
       
        DivideExpression ae = new DivideExpression(exprPlan,
                exprOpsMap.get(left), exprOpsMap.get(right));
        exprOpsMap.put(binOp, ae);
    }
View Full Code Here


       
        assertEquals( 1, genExp.getSources().size() );
       
        // Main Tests start here
        assertEquals( DivideExpression.class, genExp.getSources().get(0).getClass() );
        DivideExpression add = (DivideExpression) genExp.getSources().get(0);
        assertEquals( ls.getField(0).uid, add.getLhs().getFieldSchema().uid );
        assertEquals( ls.getField(1).uid, add.getRhs().getFieldSchema().uid );
        assertTrue( ls.getField(0).uid != add.getFieldSchema().uid );
        assertTrue( ls.getField(1).uid != add.getFieldSchema().uid );
       
        assertEquals( 1, inputPln.getLeaves().size() );
        assertEquals( Divide.class, inputPln.getLeaves().get(0).getClass() );
        Divide pDivide = (Divide) inputPln.getLeaves().get(0);
        assertEquals( 2, inputPln.getRoots().size() );
View Full Code Here

       
        assertEquals( 1, genExp.getSources().size() );
       
        // Main Tests start here
        assertEquals( DivideExpression.class, genExp.getSources().get(0).getClass() );
        DivideExpression add = (DivideExpression) genExp.getSources().get(0);
        assertEquals( ls.getField(0).uid, add.getLhs().getFieldSchema().uid );
        assertEquals( ls.getField(1).uid, add.getRhs().getFieldSchema().uid );
        assertTrue( ls.getField(0).uid != add.getFieldSchema().uid );
        assertTrue( ls.getField(1).uid != add.getFieldSchema().uid );
       
        assertEquals( 1, inputPln.getLeaves().size() );
        assertEquals( Divide.class, inputPln.getLeaves().get(0).getClass() );
        Divide pDivide = (Divide) inputPln.getLeaves().get(0);
        assertEquals( 2, inputPln.getRoots().size() );
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,  123f);

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2);
        CastExpression cast1 = new CastExpression(plan, constant3, createFS(DataType.DOUBLE));
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1);

        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.DOUBLE, div1.getType());
        assertEquals(DataType.BOOLEAN, notequal1.getType());

        // Cast insertion check
        assertEquals(DataType.DOUBLE, div1.getLhs().getType());
        assertEquals(DataType.DOUBLE, notequal1.getRhs().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, "123");

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2);
        CastExpression cast1 = new CastExpression(plan,  constant3, createFS(DataType.BYTEARRAY));
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1);

        CompilationMessageCollector collector = new CompilationMessageCollector();
        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
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,  123f) ;

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2) ;
        CastExpression cast1 = new CastExpression(plan, constant3, createFS(DataType.DOUBLE));
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1) ;

        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.DOUBLE, div1.getType()) ;
        assertEquals(DataType.BOOLEAN, notequal1.getType()) ;

        // Cast insertion check
        assertEquals(DataType.DOUBLE, div1.getLhs().getType()) ;
        assertEquals(DataType.DOUBLE, notequal1.getRhs().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, "123") ;

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2) ;
        CastExpression cast1 = new CastExpression(plan,  constant3, createFS(DataType.BYTEARRAY)) ;
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1) ;

        CompilationMessageCollector collector = new CompilationMessageCollector() ;
        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
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,  123f);

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2);
        CastExpression cast1 = new CastExpression(plan, constant3, createFS(DataType.DOUBLE));
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1);

        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.DOUBLE, div1.getType());
        assertEquals(DataType.BOOLEAN, notequal1.getType());

        // Cast insertion check
        assertEquals(DataType.DOUBLE, div1.getLhs().getType());
        assertEquals(DataType.DOUBLE, notequal1.getRhs().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, "123");

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2);
        CastExpression cast1 = new CastExpression(plan,  constant3, createFS(DataType.BYTEARRAY));
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1);

        CompilationMessageCollector collector = new CompilationMessageCollector();
        TypeCheckingExpVisitor expTypeChecker = new TypeCheckingExpVisitor(plan, collector, null);
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,  123f);

        DivideExpression div1 = new DivideExpression(plan, constant1, constant2);
        CastExpression cast1 = new CastExpression(plan, constant3, createFS(DataType.DOUBLE));
        NotEqualExpression notequal1 = new NotEqualExpression(plan, div1, cast1);

        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.DOUBLE, div1.getType());
        assertEquals(DataType.BOOLEAN, notequal1.getType());

        // Cast insertion check
        assertEquals(DataType.DOUBLE, div1.getLhs().getType());
        assertEquals(DataType.DOUBLE, notequal1.getRhs().getType());

    }
View Full Code Here

TOP

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

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.