Examples of BagToTuple


Examples of org.apache.pig.builtin.BagToTuple

  private BagFactory bf = BagFactory.getInstance();
  private TupleFactory tf = TupleFactory.getInstance();

  @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);
  }
View Full Code Here

Examples of org.apache.pig.builtin.BagToTuple

    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

Examples of org.apache.pig.builtin.BagToTuple

    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

Examples of org.apache.pig.builtin.BagToTuple

  public void testNestedDataElementsForBagToTupleUDF() throws Exception {

    DataBag inputBag = buildBagWithNestedTupleAndBag();


    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

Examples of org.apache.pig.builtin.BagToTuple

    bagSch.schema = new Schema(tupSch);

    Schema inputSch = new Schema();
    inputSch.add(bagSch);

    BagToTuple udf = new BagToTuple();
    Schema outputSchema = udf.outputSchema(inputSch);

    assertEquals("schema of BagToTuple input", expectedSch.size(),
        outputSchema.size());
    assertTrue("schema of BagToTuple input",
        Schema.equals(expectedSch, outputSchema, false, true));
View Full Code Here

Examples of org.apache.pig.builtin.BagToTuple

  public void testInvalidInputToBagToTupleUDF() throws Exception {
    TupleFactory tf = TupleFactory.getInstance();
    Tuple udfInput = tf.newTuple(1);
    // 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);
  }
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.