Examples of exec()


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

        assertEquals(milli.intValue(), 20);
        milli = func7.exec(t2);
        assertEquals(milli.intValue(), 20);

        GetWeekYear func8 = new GetWeekYear();
        Integer weekyear = func8.exec(t1);
        assertEquals(weekyear.intValue(), 2010);
        weekyear = func8.exec(t2);
        assertEquals(weekyear.intValue(), 2010);
       
        GetWeek func9 = new GetWeek();
View Full Code Here

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

        t1.set(0, new DateTime("2010-04-15T08:11:33.020Z"));
        Tuple t2 = TupleFactory.getInstance().newTuple(1);
        t2.set(0, new DateTime("2010-04-15T08:11:33.020+08:00"));
       
        GetYear func1 = new GetYear();
        Integer year = func1.exec(t1);
        assertEquals(year.intValue(), 2010);
        year = func1.exec(t2);
        assertEquals(year.intValue(), 2010);

        GetMonth func2 = new GetMonth();
View Full Code Here

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

        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);
        System.out.println("Hours: " + hours.toString());
        Assert.assertEquals(hours.longValue(), 61512L);

        MinutesBetween func6 = new MinutesBetween();
        Long mins = func6.exec(t);
View Full Code Here

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

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

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

        m.put("long", new Long(10000000000000l));
        m.put("boolean", true);
        Tuple input = TupleFactory.getInstance().newTuple(m);

        INVERSEMAP inverseMap = new INVERSEMAP();
        Map inverse  = inverseMap.exec(input);
        assertEquals(inverse.size(), 7);
        assertTrue(inverse.containsKey("apache"));
        assertTrue(inverse.containsKey("hadoop"));
        assertTrue(inverse.containsKey("pig"));
        assertTrue(inverse.containsKey("100"));
View Full Code Here

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

    public void testDoubleInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForDouble il = new InvokeForDouble("java.lang.Double.valueOf", "String");
        Tuple t = tf_.newTuple(1);
        String arg = "245";
        t.set(0, arg);
        assertEquals(Double.valueOf(arg), il.exec(t));
    }

    @Test
    public void testFloatInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForFloat il = new InvokeForFloat("java.lang.Float.valueOf", "String");
View Full Code Here

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

    public void testFloatInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForFloat il = new InvokeForFloat("java.lang.Float.valueOf", "String");
        Tuple t = tf_.newTuple(1);
        String arg = "245.3";
        t.set(0, arg);
        assertEquals(Float.valueOf(arg), il.exec(t));
    }

    public static String concatStrings(String str1, String str2) {
        return str1.concat(str2);
    }
View Full Code Here

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

    }

    @Test
    public void testNoArgInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt id = new InvokeForInt(TestInvoker.class.getName() + ".simpleStaticFunction");
      assertEquals(Integer.valueOf(1), id.exec(tf_.newTuple()));
    }
    @Test
    public void testLongInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForLong il = new InvokeForLong("java.lang.Long.valueOf", "String");
        Tuple t = tf_.newTuple(1);
View Full Code Here

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

    public void testLongInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForLong il = new InvokeForLong("java.lang.Long.valueOf", "String");
        Tuple t = tf_.newTuple(1);
        String arg = "245";
        t.set(0, arg);
        assertEquals(Long.valueOf(arg), il.exec(t));
    }

    @Test
    public void testIntInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, NumberFormatException, IOException {
        InvokeForInt il = new InvokeForInt("java.lang.Integer.valueOf", "String");
View Full Code Here

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

    @Test
    public void testStringInvoker() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {

        // Test non-static method
        InvokeForString is = new InvokeForString("java.lang.String.toUpperCase", "String", "false");
        assertEquals("FOO", is.exec(tf_.newTuple("foo")));

        // both "static" and "true" should work
        // Test static method
        is = new InvokeForString("java.lang.String.valueOf", "int", "true");
        Tuple t = tf_.newTuple(1);
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.