Examples of exec()


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

        bloom.setFilter((DataByteArray)t.get(0));

        // Test that everything we put in passes.
        Tuple t1 = tf.newTuple(1);
        t1.set(0, 1);
        assertTrue(bloom.exec(t1));

        // A few that don't pass
        for (int i = 100; i < 10; i++) {
            Tuple t2 = tf.newTuple(1);
            t2.set(0, i);
View Full Code Here

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

        EvalFunc<DataByteArray> concat = new CONCAT();
       
        Tuple t = TupleFactory.getInstance().newTuple(2);
        t.set(0, dbaA);
        t.set(1, dbaB);
        DataByteArray result = concat.exec(t);
        String msg = "[Testing CONCAT on input type: bytearray]";
        assertTrue(msg, result.equals(dbaExpected));
       
        // String concat
        String s1 = "unit ";
View Full Code Here

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

        tup1.set(0, 4.0);
        dBag1.add(tup1);
        input = TupleFactory.getInstance().newTuple(2);
        input.set(0, dBag);
        input.set(1, dBag1);
        output = cor.exec(input);
        it = output.iterator();
        ans = (Tuple) it.next();
        assertEquals((String)ans.get(0),"a");
        assertEquals((String)ans.get(1),"b");
        assertEquals(0.582222509739582, (Double)ans.get(2) ,0.0005);
View Full Code Here

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

        Integer input[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, null };
        long expected = input.length - 1;

        EvalFunc<Long> count = new COUNT();
        Tuple tup = Util.loadNestTuple(TupleFactory.getInstance().newTuple(1), input);
        Long output = count.exec(tup);

        assertTrue(output == expected);
    }

    @Test
View Full Code Here

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

        Integer input[] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, null };
        long expected = input.length;

        EvalFunc<Long> count = new COUNT_STAR();
        Tuple tup = Util.loadNestTuple(TupleFactory.getInstance().newTuple(1), input);
        Long output = count.exec(tup);

        assertTrue(output == expected);
    }

    @Test
View Full Code Here

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

        tup1.set(0, 4.0);
        dBag1.add(tup1);
        Tuple input = TupleFactory.getInstance().newTuple(2);
        input.set(0, dBag);
        input.set(1, dBag1);
        DataBag output = cov.exec(input);
        Iterator<Tuple> it = output.iterator();
        Tuple ans = (Tuple)it.next();
        assertEquals((String)ans.get(0),"a");
        assertEquals((String)ans.get(1),"b");
        assertEquals(1.11111, (Double)ans.get(2),0.0005);
View Full Code Here

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

                TF.newTuple(ImmutableList.of("ALL", "ALL", "ALL")),
                TF.newTuple(ImmutableList.of("ALL", "b", "ALL"))
        );

        CubeDimensions cd = new CubeDimensions("ALL");
        DataBag bag = cd.exec(t);
        assertEquals(bag.size(), expected.size());

        for (Tuple tup : bag) {
            assertTrue(expected.contains(tup));
        }
View Full Code Here

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

        t13.set(0, new DateTime(1231290421000L));
        Long ut2 = func7.exec(t11);
        assertEquals(ut2.longValue(), 1231290421000L);
       
        CurrentTime func8 = new CurrentTime();
        DateTime dt11 = func8.exec(null);
        Assert.assertNotNull(dt11);
    }

    /**
     * Test the case where the combiner is not called - so initial is called
View Full Code Here

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

        for (int i = 0; i < 10; i += 2) b2.add(tf.newTuple(new Integer(i)));
        Tuple t = tf.newTuple(2);
        t.set(0, b1);
        t.set(1, b2);
        DIFF d = new DIFF();
        DataBag result = d.exec(t);

        assertEquals(5, result.size());
        Iterator<Tuple> i = result.iterator();
        int[] values = new int[5];
        for (int j = 0; j < 5; j++) values[j] = (Integer)i.next().get(0);
View Full Code Here

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

        Long weeks = func3.exec(t);
        System.out.println("Weeks: " + weeks.toString());
        Assert.assertEquals(weeks.longValue(), 366L);

        DaysBetween func4 = new DaysBetween();
        Long days = func4.exec(t);
        System.out.println("Days: " + days.toString());
        Assert.assertEquals(days.longValue(), 2563L);

        HoursBetween func5 = new HoursBetween();
        Long hours = func5.exec(t);
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.