Package org.apache.pig.builtin

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


  @Test
  public void testNullInputBagToTupleUDF() throws Exception {
    BagToTuple udf = new BagToTuple();
    Tuple udfInput = tf.newTuple(1);
    udfInput.set(0, null);
    Tuple output = udf.exec(udfInput);
    assertNull(output);
  }

  @Test
  public void testBasicBagToTupleUDF() throws Exception {
View Full Code Here


    Tuple udfInput = tf.newTuple(1);
    udfInput.set(0, bag);

    // invoking UDF
    BagToTuple udf = new BagToTuple();
    Tuple result = udf.exec(udfInput);

    int totalExpectedSize = t1.size() + t2.size();
    assertEquals(totalExpectedSize, result.size());

    for (int i = 0; i < t1.size(); i++) {
View Full Code Here

    Tuple udfInput = tf.newTuple(1);
    udfInput.set(0, bag);

    // invoking UDF
    BagToTuple udf = new BagToTuple();
    Tuple outputTuple = udf.exec(udfInput);

    int totalExpectedSize = t1.size() + t2.size() + t3.size();
    assertEquals(totalExpectedSize, outputTuple.size());

    for (int i = 0; i < t1.size(); i++) {
View Full Code Here


    BagToTuple udf = new BagToTuple();
    Tuple udfInput = tf.newTuple(1);
    udfInput.set(0, inputBag);
    Tuple outputTuple = udf.exec(udfInput);


    Iterator<Tuple> inputBagIterator = inputBag.iterator();
    Tuple firstTuple = inputBagIterator.next();
    for (int i = 0; i < firstTuple.size(); i++) {
View Full Code Here

    // input contains tuple instead of bag
    udfInput.set(0, tf.newTuple());
    BagToTuple udf = new BagToTuple();

    // expecting an exception because the input if of type Tuple, not DataBag
    udf.exec(udfInput);
  }


  @Test
  public void testNullInputBagToStringUDF() throws Exception {
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.