Examples of numval()


Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> avg = new AVG.Final();
        DataAtom output = new DataAtom();
        avg.exec(tup, output);

        assertEquals("Expected average to be 4.852941176470588",
            4.852941176470588, output.numval());
    }


    @Test
    public void testCOUNT() throws Exception {
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> count = new COUNT();
        FilterFunc isEmpty = new IsEmpty();
       
        assertTrue(isEmpty.exec(tup));
        count.exec(tup,output);
        assertTrue(output.numval() == 0);
       
        map.put("a", new DataAtom("a"));

        assertFalse(isEmpty.exec(tup));
        count.exec(tup,output);
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

       
        map.put("a", new DataAtom("a"));

        assertFalse(isEmpty.exec(tup));
        count.exec(tup,output);
        assertTrue(output.numval() == 1);

       
        map.put("b", new Tuple());

        assertFalse(isEmpty.exec(tup));
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

       
        map.put("b", new Tuple());

        assertFalse(isEmpty.exec(tup));
        count.exec(tup,output);
        assertTrue(output.numval() == 2);
       
    }

    @Test
    public void testCOUNTInitial() throws Exception {
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> sum = new SUM.Final();
        DataAtom output = new DataAtom();
        sum.exec(tup, output);

        assertEquals("Expected sum to be 100.0", 100.0, output.numval());
    }

    @Test
    public void testMIN() throws Exception {
        int input[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> min = new MIN();
        Tuple tup = Util.loadNestTuple(new Tuple(1), input);
        DataAtom output = new DataAtom();
        min.exec(tup, output);

        assertEquals("Expected min to be 1.0", 1.0, output.numval());
    }


    @Test
    public void testMINInitial() throws Exception {
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> min = new MIN.Final();
        DataAtom output = new DataAtom();
        min.exec(tup, output);

        assertEquals("Expected sum to be 23.0", 23.0, output.numval());
    }

    @Test
    public void testMAX() throws Exception {
        int input[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> max = new MAX();
        Tuple tup = Util.loadNestTuple(new Tuple(1), input);
        DataAtom output = new DataAtom();
        max.exec(tup, output);

        assertEquals("Expected max to be 10.0", 10.0, output.numval());
    }


    @Test
    public void testMAXInitial() throws Exception {
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

        EvalFunc<DataAtom> max = new MAX.Final();
        DataAtom output = new DataAtom();
        max.exec(tup, output);

        assertEquals("Expected sum to be 39.0", 39.0, output.numval());
    }


    // Builtin APPLY Functions
    // ========================
View Full Code Here

Examples of org.apache.pig.data.DataAtom.numval()

       
        switch (op1) {
            // numeric ops first
        case '=':
            if (op2 == '=') {
                return da1.numval().equals(da2.numval());
            } else {
                throw new RuntimeException("Internal error: Invalid filter operator: " + op);
            }
        case '<':
            if (op2 == '=') {
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.