Package org.apache.pig.builtin

Examples of org.apache.pig.builtin.ROUND.exec()


        tup.set(0, -1.0d); assertEquals(-1l, lng_out = rounder.exec(tup));
        tup.set(0, -2.4d); assertEquals(-2l, lng_out = rounder.exec(tup));
        tup.set(0, -4.6d); assertEquals(-5l, lng_out = rounder.exec(tup));

        // Rounds towards positive infinity: round(x) = floor(x + 0.5)
        tup.set(03.5d); assertEquals( 4l, lng_out = rounder.exec(tup));
        tup.set(0, -3.5d); assertEquals(-3l, lng_out = rounder.exec(tup));
        tup.set(02.5d); assertEquals( 3l, lng_out = rounder.exec(tup));
        tup.set(0, -2.5d); assertEquals(-2l, lng_out = rounder.exec(tup));

        // we don't need to test null input because of SKIP_UDF_CALL_FOR_NULL behavior
View Full Code Here


        tup.set(0, -2.4d); assertEquals(-2l, lng_out = rounder.exec(tup));
        tup.set(0, -4.6d); assertEquals(-5l, lng_out = rounder.exec(tup));

        // Rounds towards positive infinity: round(x) = floor(x + 0.5)
        tup.set(03.5d); assertEquals( 4l, lng_out = rounder.exec(tup));
        tup.set(0, -3.5d); assertEquals(-3l, lng_out = rounder.exec(tup));
        tup.set(02.5d); assertEquals( 3l, lng_out = rounder.exec(tup));
        tup.set(0, -2.5d); assertEquals(-2l, lng_out = rounder.exec(tup));

        // we don't need to test null input because of SKIP_UDF_CALL_FOR_NULL behavior
    }
View Full Code Here

        tup.set(0, -4.6d); assertEquals(-5l, lng_out = rounder.exec(tup));

        // Rounds towards positive infinity: round(x) = floor(x + 0.5)
        tup.set(03.5d); assertEquals( 4l, lng_out = rounder.exec(tup));
        tup.set(0, -3.5d); assertEquals(-3l, lng_out = rounder.exec(tup));
        tup.set(02.5d); assertEquals( 3l, lng_out = rounder.exec(tup));
        tup.set(0, -2.5d); assertEquals(-2l, lng_out = rounder.exec(tup));

        // we don't need to test null input because of SKIP_UDF_CALL_FOR_NULL behavior
    }
View Full Code Here

        // Rounds towards positive infinity: round(x) = floor(x + 0.5)
        tup.set(03.5d); assertEquals( 4l, lng_out = rounder.exec(tup));
        tup.set(0, -3.5d); assertEquals(-3l, lng_out = rounder.exec(tup));
        tup.set(02.5d); assertEquals( 3l, lng_out = rounder.exec(tup));
        tup.set(0, -2.5d); assertEquals(-2l, lng_out = rounder.exec(tup));

        // we don't need to test null input because of SKIP_UDF_CALL_FOR_NULL behavior
    }

    @Test
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.