Examples of exec()


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

        m.put("1", "hadoop");
        m.put("source", "code");
        Tuple input = TupleFactory.getInstance().newTuple(m);

        KEYSET keySet = new KEYSET();
        DataBag result = keySet.exec(input);
        Iterator<Tuple> i = result.iterator();
        assertEquals(result.size(), m.size());

        while(i.hasNext()) {
            Tuple t = i.next();
View Full Code Here

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

   
    @Test
    public void testLastIndexOf() throws IOException {
        LAST_INDEX_OF lastIndexOf = new LAST_INDEX_OF();
        Tuple testTuple = Util.buildTuple("xyz", "");
        assertEquals( ((Integer) "xyz".lastIndexOf("")), lastIndexOf.exec(testTuple));
       
        testTuple = Util.buildTuple(null, null);
        assertNull(lastIndexOf.exec(testTuple));
       
        testTuple = Util.buildTuple("xyzyy", "y");
View Full Code Here

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

    @Test
    public void testLtrim() throws IOException {
        LTRIM trim = new LTRIM();
        Tuple testTuple = Util.buildTuple("nospaces");
        assertEquals("nospaces", trim.exec(testTuple));
       
        testTuple = Util.buildTuple("spaces right    ");
        assertEquals("spaces right    ", trim.exec(testTuple));
       
        testTuple = Util.buildTuple("    spaces left");
View Full Code Here

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

        Long secs = func7.exec(t);
        System.out.println("Seconds: " + secs.toString());
        Assert.assertEquals(secs.longValue(), 221443200L);

        MilliSecondsBetween func8 = new MilliSecondsBetween();
        Long millis = func8.exec(t);
        System.out.println("MilliSeconds: " + millis.toString());
        Assert.assertEquals(millis.longValue(), 221443200000L);
    }

    @Test
View Full Code Here

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

        Long hours = func5.exec(t);
        System.out.println("Hours: " + hours.toString());
        Assert.assertEquals(hours.longValue(), 61512L);

        MinutesBetween func6 = new MinutesBetween();
        Long mins = func6.exec(t);
        System.out.println("Minutes: " + mins.toString());
        Assert.assertEquals(mins.longValue(), 3690720L);

        SecondsBetween func7 = new SecondsBetween();
        Long secs = func7.exec(t);
View Full Code Here

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

        Long years = func1.exec(t);
        System.out.println("Years: " + years.toString());
        Assert.assertEquals(years.longValue(), 7L);
       
        MonthsBetween func2 = new MonthsBetween();
        Long months = func2.exec(t);
        System.out.println("Months: " + months.toString());
        Assert.assertEquals(months.longValue(),84L);
       
        WeeksBetween func3 = new WeeksBetween();
        Long weeks = func3.exec(t);
View Full Code Here

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

        t3.set(0, null);
        t3.set(1, "^\\/search\\/iy\\/(.*?)\\/.*");
        t3.set(2, 2);
       
        REGEX_EXTRACT func = new REGEX_EXTRACT();
        String r = func.exec(t1);
        assertTrue(r.equals("term1"));
        r = func.exec(t2);
        assertTrue(r==null);
        r = func.exec(t3);
        assertTrue(r==null);
View Full Code Here

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

        Tuple te3 = tupleFactory.newTuple(2);
        te3.set(0, null);
        te3.set(1, matchRegex);
    
        REGEX_EXTRACT_ALL funce = new REGEX_EXTRACT_ALL();
        Tuple re = funce.exec(te1);
        assertEquals(re.size(), 2);
        assertEquals("this", re.get(0));
        assertEquals("match", re.get(1));
       
        re = funce.exec(te2);
View Full Code Here

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

   
    @Test
    public void testReplace() throws IOException {
        REPLACE replace = new REPLACE();
        Tuple testTuple = Util.buildTuple("foobar", "z", "x");
        assertEquals("foobar".replace("z", "x"), replace.exec(testTuple));
       
        testTuple = Util.buildTuple("foobar", "oo", "aa");
        assertEquals("foobar".replace("oo", "aa"), replace.exec(testTuple));
    }
   
View Full Code Here

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

        Tuple          tup     = TupleFactory.getInstance().newTuple(1);
        long           expected, lng_out;

        tup.set(0, dbl);
        expected = Math.round(dbl);
        lng_out   = rounder.exec(tup);
        assertEquals(expected, lng_out);

        tup.set(0, flt);
        expected = Math.round(flt);
        lng_out   = rounder.exec(tup);
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.