Package org.apache.pig.builtin

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


        Tuple test2 = TupleFactory.getInstance().newTuple(2);
        Tuple test3 = TupleFactory.getInstance().newTuple(3);
       
        test2.set(0, "foo");
        test2.set(1, ":");
        Tuple splits = splitter.exec(test2);
        assertEquals("no matches should return tuple with original string", 1, splits.size());
        assertEquals("no matches should return tuple with original string", "foo",
                splits.get(0));
           
        // test default delimiter
View Full Code Here


        assertEquals("no matches should return tuple with original string", "foo",
                splits.get(0));
           
        // test default delimiter
        test1.set(0, "f ooo bar");
        splits = splitter.exec(test1);
        assertEquals("split on default value ", 3, splits.size());
        assertEquals("f", splits.get(0));
        assertEquals("ooo", splits.get(1));
        assertEquals("bar", splits.get(2));
       
View Full Code Here

        assertEquals("ooo", splits.get(1));
        assertEquals("bar", splits.get(2));
       
        // test trimming of whitespace
        test1.set(0, "foo bar  ");
        splits = splitter.exec(test1);
        assertEquals("whitespace trimmed if no length arg", 2, splits.size());
       
        // test forcing null matches with length param
        test3.set(0, "foo bar   ");
        test3.set(1, "\\s");
View Full Code Here

       
        // test forcing null matches with length param
        test3.set(0, "foo bar   ");
        test3.set(1, "\\s");
        test3.set(2, 10);
        splits = splitter.exec(test3);
        assertEquals("length forces empty string matches on end", 5, splits.size());
       
        // test limiting results with limit
        test3.set(0, "foo:bar:baz");
        test3.set(1, ":");
View Full Code Here

       
        // test limiting results with limit
        test3.set(0, "foo:bar:baz");
        test3.set(1, ":");
        test3.set(2, 2);
        splits = splitter.exec(test3);
        assertEquals(2, splits.size());
        assertEquals("foo", splits.get(0));
        assertEquals("bar:baz", splits.get(1));
       
        Tuple t1 = TupleFactory.getInstance().newTuple(3);
View Full Code Here

        Tuple test2 = TupleFactory.getInstance().newTuple(2);
        Tuple test3 = TupleFactory.getInstance().newTuple(3);
       
        test2.set(0, "foo");
        test2.set(1, ":");
        Tuple splits = splitter.exec(test2);
        assertEquals("no matches should return tuple with original string", 1, splits.size());
        assertEquals("no matches should return tuple with original string", "foo",
                splits.get(0));
           
        // test default delimiter
View Full Code Here

        assertEquals("no matches should return tuple with original string", "foo",
                splits.get(0));
           
        // test default delimiter
        test1.set(0, "f ooo bar");
        splits = splitter.exec(test1);
        assertEquals("split on default value ", 3, splits.size());
        assertEquals("f", splits.get(0));
        assertEquals("ooo", splits.get(1));
        assertEquals("bar", splits.get(2));
       
View Full Code Here

        assertEquals("ooo", splits.get(1));
        assertEquals("bar", splits.get(2));
       
        // test trimming of whitespace
        test1.set(0, "foo bar  ");
        splits = splitter.exec(test1);
        assertEquals("whitespace trimmed if no length arg", 2, splits.size());
       
        // test forcing null matches with length param
        test3.set(0, "foo bar   ");
        test3.set(1, "\\s");
View Full Code Here

       
        // test forcing null matches with length param
        test3.set(0, "foo bar   ");
        test3.set(1, "\\s");
        test3.set(2, 10);
        splits = splitter.exec(test3);
        assertEquals("length forces empty string matches on end", 5, splits.size());
       
        // test limiting results with limit
        test3.set(0, "foo:bar:baz");
        test3.set(1, ":");
View Full Code Here

       
        // test limiting results with limit
        test3.set(0, "foo:bar:baz");
        test3.set(1, ":");
        test3.set(2, 2);
        splits = splitter.exec(test3);
        assertEquals(2, splits.size());
        assertEquals("foo", splits.get(0));
        assertEquals("bar:baz", splits.get(1));
       
        Tuple t1 = TupleFactory.getInstance().newTuple(3);
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.