Search in sources :

Example 1 with TupleFactory

use of org.apache.pig.data.TupleFactory in project akela by mozilla-metrics.

the class JsonTupleMapTest method getTestTuple.

// Construct a tuple that represents this json:
//   {"stacks":[[[4,3],[2,1]], [[1,2],[3,4]]]}
public Tuple getTestTuple() {
    TupleFactory tupleFactory = TupleFactory.getInstance();
    Tuple tAll = tupleFactory.newTuple();
    Tuple t1 = tupleFactory.newTuple();
    Tuple t1a = tupleFactory.newTuple();
    t1a.append(4);
    t1a.append(3);
    Tuple t1b = tupleFactory.newTuple();
    t1b.append(2);
    t1b.append(1);
    t1.append(t1a);
    t1.append(t1b);
    Tuple t2 = tupleFactory.newTuple();
    Tuple t2a = tupleFactory.newTuple();
    t2a.append(1);
    t2a.append(2);
    Tuple t2b = tupleFactory.newTuple();
    t2b.append(3);
    t2b.append(4);
    t2.append(t2a);
    t2.append(t2b);
    tAll.append(t1);
    tAll.append(t2);
    return tAll;
}
Also used : TupleFactory(org.apache.pig.data.TupleFactory) Tuple(org.apache.pig.data.Tuple)

Aggregations

Tuple (org.apache.pig.data.Tuple)1 TupleFactory (org.apache.pig.data.TupleFactory)1