Schema schema = writer.getSchema();
Tuple tuple = TypesUtils.createTuple(schema);
BasicTable.Writer writer1 = new BasicTable.Writer(path, conf);
int part = 0;
TableInserter inserter = writer1.getInserter("part" + part, true);
TypesUtils.resetTuple(tuple);
DataBag bagColl = TypesUtils.createBag();
Schema schColl = schema.getColumn(0).getSchema().getColumn(0).getSchema();
Tuple tupColl1 = TypesUtils.createTuple(schColl);
Tuple tupColl2 = TypesUtils.createTuple(schColl);
byte[] abs1 = new byte[3];
byte[] abs2 = new byte[4];
tupColl1.set(0, 3.1415926);
tupColl1.set(1, 1.6);
abs1[0] = 11;
abs1[1] = 12;
abs1[2] = 13;
tupColl1.set(2, new DataByteArray(abs1));
bagColl.add(tupColl1);
tupColl2.set(0, 123.456789);
tupColl2.set(1, 100);
abs2[0] = 21;
abs2[1] = 22;
abs2[2] = 23;
abs2[3] = 24;
tupColl2.set(2, new DataByteArray(abs2));
bagColl.add(tupColl2);
tuple.set(0, bagColl);
int row = 0;
inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
.getBytes()), tuple);
bagColl.clear();
TypesUtils.resetTuple(tupColl1);
TypesUtils.resetTuple(tupColl2);
tupColl1.set(0, 7654.321);
tupColl1.set(1, 0.0001);
abs1[0] = 31;
abs1[1] = 32;
abs1[2] = 33;
tupColl1.set(2, new DataByteArray(abs1));
bagColl.add(tupColl1);
tupColl2.set(0, 0.123456789);
tupColl2.set(1, 0.3333);
abs2[0] = 41;
abs2[1] = 42;
abs2[2] = 43;
abs2[3] = 44;
tupColl2.set(2, new DataByteArray(abs2));
bagColl.add(tupColl2);
tuple.set(0, bagColl);
inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
.getBytes()), tuple);
inserter.close();
writer1.finish();
writer.close();
}