"c1:collection(a:double, b:float, c:bytes),c2:collection(r1:record(f1:int, f2:string), d:string),c3:collection(c3_1:collection(e:int,f:bool))";
Schema schema = new Schema(STR_SCHEMA);
Tuple tuple = TypesUtils.createTuple(schema);
TypesUtils.resetTuple(tuple);
DataBag bag1 = TypesUtils.createBag();
Schema schColl = new Schema("a:double, b:float, c:bytes");
Tuple tupColl1 = TypesUtils.createTuple(schColl);
Tuple tupColl2 = TypesUtils.createTuple(schColl);
DataBag bag2 = TypesUtils.createBag();
Schema schColl2 = new Schema("r1:record(f1:int, f2:string), d:string");
Tuple tupColl2_1 = TypesUtils.createTuple(schColl2);
Tuple tupColl2_2 = TypesUtils.createTuple(schColl2);
Tuple collRecord1;
try {
collRecord1 = TypesUtils.createTuple(new Schema("f1:int, f2:string"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
Tuple collRecord2;
try {
collRecord2 = TypesUtils.createTuple(new Schema("f1:int, f2:string"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
// c3:collection(c3_1:collection(e:int,f:bool))
DataBag bag3 = TypesUtils.createBag();
DataBag bag3_1 = TypesUtils.createBag();
DataBag bag3_2 = TypesUtils.createBag();
Tuple tupColl3_1 = null;
try {
tupColl3_1 = TypesUtils.createTuple(new Schema("e:int,f:bool"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
Tuple tupColl3_2;
try {
tupColl3_2 = TypesUtils.createTuple(new Schema("e:int,f:bool"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
Tuple tupColl3_3 = null;
try {
tupColl3_3 = TypesUtils.createTuple(new Schema("e:int,f:bool"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
Tuple tupColl3_4;
try {
tupColl3_4 = TypesUtils.createTuple(new Schema("e:int,f:bool"));
} catch (ParseException e) {
e.printStackTrace();
throw new IOException(e);
}
byte[] abs1 = new byte[3];
byte[] abs2 = new byte[4];
tupColl1.set(0, 3.1415926);
tupColl1.set(1, 1.6);
abs1[0] = 'a';
abs1[1] = 'a';
abs1[2] = 'a';
tupColl1.set(2, new DataByteArray(abs1));
bag1.add(tupColl1);
tupColl2.set(0, 123.456789);
tupColl2.set(1, 100);
abs2[0] = 'b';
abs2[1] = 'c';
abs2[2] = 'd';
abs2[3] = 'e';
tupColl2.set(2, new DataByteArray(abs2));
bag1.add(tupColl2);
tuple.set(0, bag1);
collRecord1.set(0, 1);
collRecord1.set(1, "record1_string1");
tupColl2_1.set(0, collRecord1);
tupColl2_1.set(1, "hello1");
bag2.add(tupColl2_1);
collRecord2.set(0, 2);
collRecord2.set(1, "record2_string1");
tupColl2_2.set(0, collRecord2);
tupColl2_2.set(1, "hello2");
bag2.add(tupColl2_2);
tuple.set(1, bag2);
TypesUtils.resetTuple(tupColl3_1);
TypesUtils.resetTuple(tupColl3_2);
tupColl3_1.set(0, 1);
tupColl3_1.set(1, true);
tupColl3_2.set(0, 2);
tupColl3_2.set(1, false);
bag3_1.add(tupColl3_1);
bag3_1.add(tupColl3_2);
bag3.addAll(bag3_1);
tupColl3_3.set(0, 3);
tupColl3_3.set(1, true);
tupColl3_4.set(0, 4);
tupColl3_4.set(1, false);
bag3_2.add(tupColl3_3);
bag3_2.add(tupColl3_4);
bag3.addAll(bag3_2);
tuple.set(2, bag3);
Assert.assertTrue(tuple.toString().equals("3.1415926,1.6,#aaa\n" +
"123.456789,100,#bcde\n" +