Package org.apache.pig.builtin

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


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

    @Test
    public void testArrayConversion() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "double[]");
View Full Code Here

    @Test
    public void testArrayConversion() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "double[]");
      DataBag nums = newSimpleBag(1.0, 2.0, 3.0);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));
     
      ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "long[]");
      nums = newSimpleBag(1L, 2L, 3L);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));
View Full Code Here

      DataBag nums = newSimpleBag(1.0, 2.0, 3.0);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));
     
      ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "long[]");
      nums = newSimpleBag(1L, 2L, 3L);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));

      InvokeForString is = new InvokeForString(TestInvoker.class.getName() + ".concatStringArray", "string[]");
      DataBag strings = newSimpleBag("foo", "bar", "baz");
      assertEquals("foobarbaz", is.exec(tf_.newTuple(strings)));
    }
View Full Code Here

    }

    @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

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

    @Test
    public void testArrayConversion() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "double[]");
View Full Code Here

    @Test
    public void testArrayConversion() throws SecurityException, ClassNotFoundException, NoSuchMethodException, IOException {
      InvokeForInt ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "double[]");
      DataBag nums = newSimpleBag(1.0, 2.0, 3.0);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));
     
      ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "long[]");
      nums = newSimpleBag(1L, 2L, 3L);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));
View Full Code Here

      DataBag nums = newSimpleBag(1.0, 2.0, 3.0);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));
     
      ii = new InvokeForInt(TestInvoker.class.getName() + ".avg", "long[]");
      nums = newSimpleBag(1L, 2L, 3L);
      assertEquals(Integer.valueOf(2), ii.exec(tf_.newTuple(nums)));

      InvokeForString is = new InvokeForString(TestInvoker.class.getName() + ".concatStringArray", "string[]");
      DataBag strings = newSimpleBag("foo", "bar", "baz");
      assertEquals("foobarbaz", is.exec(tf_.newTuple(strings)));
    }
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.