@Test
public void testCollection() throws IOException, ParseException {
String STR_SCHEMA =
"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);
}