Package org.apache.pig.impl.logicalLayer

Examples of org.apache.pig.impl.logicalLayer.ExpressionOperator


    }

    @Override
    public void visit(LOLesserThanEqual binOp) throws VisitorException {
        ExpressionOperator lhs = binOp.getLhsOperand() ;
        ExpressionOperator rhs = binOp.getRhsOperand() ;

        byte lhsType = lhs.getType() ;
        byte rhsType = rhs.getType() ;

        if ( DataType.isNumberType(lhsType) &&
                DataType.isNumberType(rhsType) ) {
            // If not the same type, we cast them to the same
            byte biggerType = lhsType > rhsType ? lhsType:rhsType ;
View Full Code Here




    @Override
    public void visit(LOEqual binOp) throws VisitorException {
        ExpressionOperator lhs = binOp.getLhsOperand() ;
        ExpressionOperator rhs = binOp.getRhsOperand() ;

        byte lhsType = lhs.getType() ;
        byte rhsType = rhs.getType() ;

        if ( DataType.isNumberType(lhsType) &&
                DataType.isNumberType(rhsType) ) {

            byte biggerType = lhsType > rhsType ? lhsType:rhsType ;
View Full Code Here

    }

    @Override
    public void visit(LONotEqual binOp) throws VisitorException {
        ExpressionOperator lhs = binOp.getLhsOperand() ;
        ExpressionOperator rhs = binOp.getRhsOperand() ;

        byte lhsType = lhs.getType() ;
        byte rhsType = rhs.getType() ;


        if ( DataType.isNumberType(lhsType) &&
                DataType.isNumberType(rhsType) ) {
View Full Code Here

    }

    @Override
    public void visit(LOMod binOp) throws VisitorException {
        ExpressionOperator lhs = binOp.getLhsOperand() ;
        ExpressionOperator rhs = binOp.getRhsOperand() ;

        byte lhsType = lhs.getType() ;
        byte rhsType = rhs.getType() ;

        if ( (lhsType == DataType.INTEGER) &&
             (rhsType == DataType.INTEGER)
           ) {
           //do nothing
View Full Code Here

        // then it will never match algebraic functions' schemas
        // without this

        // Assuming all aggregates has only one argument at this stage
        if(func.getArguments()!=null && func.getArguments().size()>0){
            ExpressionOperator tmpExp = func.getArguments().get(0) ;
            if ( (ef instanceof Algebraic)
                 && (tmpExp instanceof LOProject)
                 && (((LOProject)tmpExp).getSentinel())) {
   
                FieldSchema tmpField ;
View Full Code Here

        if (leaves.size() > 1) {
            int errCode = 2060;
            String msg = "Expected one leaf. Found " + leaves.size() + " leaves.";
            throw new TypeCheckerException(msg, errCode, PigException.BUG);
        }
        ExpressionOperator currentOutput = (ExpressionOperator) leaves.get(0);
        collectCastWarning(frj, currentOutput.getType(), toType);
        OperatorKey newKey = genNewOperatorKey(currentOutput);
        LOCast cast = new LOCast(innerPlan, newKey, toType);
        innerPlan.add(cast);
        try {
            innerPlan.connect(currentOutput, cast);
View Full Code Here

        if (leaves.size() > 1) {
            int errCode = 2060;
            String msg = "Expected one leaf. Found " + leaves.size() + " leaves.";
            throw new TypeCheckerException(msg, errCode, PigException.BUG);
        }
        ExpressionOperator currentOutput = (ExpressionOperator) leaves.get(0) ;
        collectCastWarning(cg, currentOutput.getType(), toType) ;
        OperatorKey newKey = genNewOperatorKey(currentOutput) ;
        LOCast cast = new LOCast(innerPlan, newKey, toType) ;
        innerPlan.add(cast) ;
        try {
            innerPlan.connect(currentOutput, cast) ;
View Full Code Here

            ArrayList<LogicalPlan> generatePlans = new ArrayList<LogicalPlan>();
            String scope = load.getOperatorKey().scope;
            for (int pos : columnsToProject) {
                LogicalPlan projectPlan = new LogicalPlan();
                LogicalOperator projectInput = load;
                ExpressionOperator column = new LOProject(projectPlan, new OperatorKey(scope, NodeIdGenerator.getGenerator().getNextNodeId(scope)), projectInput, pos);
                flattenList.add(false);
                projectPlan.add(column);
                generatePlans.add(projectPlan);
            }
            forEach = new LOForEach(mPlan, new OperatorKey(scope, NodeIdGenerator.getGenerator().getNextNodeId(scope)), generatePlans, flattenList);
View Full Code Here

    }

    public void visit(LOAnd binOp) throws VisitorException {
        // if lhs or rhs is null constant then cast it to boolean
        insertCastsForNullToBoolean(binOp);
        ExpressionOperator lhs = binOp.getLhsOperand();
        ExpressionOperator rhs = binOp.getRhsOperand();

        byte lhsType = lhs.getType() ;
        byte rhsType = rhs.getType() ;

        if (  (lhsType != DataType.BOOLEAN||
              (rhsType != DataType.BOOLEAN)  ) {
            int errCode = 1038;
            String msg = "Operands of AND/OR can be boolean only" ;
View Full Code Here

    @Override
    public void visit(LOOr binOp) throws VisitorException {
        // if lhs or rhs is null constant then cast it to boolean
        insertCastsForNullToBoolean(binOp);
        ExpressionOperator lhs = binOp.getLhsOperand();
        ExpressionOperator rhs = binOp.getRhsOperand();

        byte lhsType = lhs.getType() ;
        byte rhsType = rhs.getType() ;

        if (  (lhsType != DataType.BOOLEAN||
              (rhsType != DataType.BOOLEAN)  ) {
            int errCode = 1038;
            String msg = "Operands of AND/OR can be boolean only" ;
View Full Code Here

TOP

Related Classes of org.apache.pig.impl.logicalLayer.ExpressionOperator

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.