Package org.apache.pig.data

Examples of org.apache.pig.data.DataMap


        assertTrue(actual == expected);
    }

    @Test
    public void testCOUNTMap() throws Exception {
        DataMap map = new DataMap();
       
        Tuple tup = new Tuple();
        tup.appendField(map);
        DataAtom output = new DataAtom();
       
       
        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);
        assertTrue(output.numval() == 1);

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

        assertFalse(isEmpty.exec(tup));
        count.exec(tup,output);
        assertTrue(output.numval() == 2);
       
View Full Code Here


                else if (returnType == Tuple.class)
                    return new Tuple();
                else if (returnType == DataBag.class)
                    return new FakeDataBag(successor);
                else if (returnType == DataMap.class)
                    return new DataMap();
                else throw new RuntimeException("Internal error: Unknown return type of eval function");
            }
           
            @Override
            public void add(Datum d) {
View Full Code Here

TOP

Related Classes of org.apache.pig.data.DataMap

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.