tupRecord1.set(0, "1");
tupRecord1.set(1, "hello1");
tuple.set(2, tupRecord1);
tuple.set(3, "world1");
inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
.getBytes()), tuple);
// second row
row++;
TypesUtils.resetTuple(tuple);
TypesUtils.resetTuple(tupRecord1);
TypesUtils.resetTuple(tupColl1);
TypesUtils.resetTuple(tupColl2);
m1.clear();
bag1.clear();
row++;
tupColl1.set(0, "2.2");
tupColl1.set(1, "2.22");
bag1.add(tupColl1);
tupColl2.set(0, "2.222");
tupColl2.set(1, "2.2222");
bag1.add(tupColl2);
tuple.set(0, bag1);
m1.put("k2", "k22");
m1.put("k3", "k32");
m1.put("k1", "k12");
m1.put("k4", "k42");
tuple.set(1, m1);
tupRecord1.set(0, "2");
tupRecord1.set(1, "hello2");
tuple.set(2, tupRecord1);
tuple.set(3, "world2");
inserter.insert(new BytesWritable(String.format("k%d%d", part + 1, row + 1)
.getBytes()), tuple);
inserter.close();
writer1.finish();
writer.close();
/*
* create 2nd basic table;
*/
pathTable2 = new Path(pathWorking, "2");
System.out.println("pathTable2 =" + pathTable2);
BasicTable.Writer writer2 = new BasicTable.Writer(pathTable2, STR_SCHEMA2,
STR_STORAGE2, conf);
Schema schema2 = writer.getSchema();
Tuple tuple2 = TypesUtils.createTuple(schema2);
BasicTable.Writer writer22 = new BasicTable.Writer(pathTable2, conf);
part = 0;
TableInserter inserter2 = writer22.getInserter("part" + part, true);
TypesUtils.resetTuple(tuple2);
TypesUtils.resetTuple(tuple);
TypesUtils.resetTuple(tupRecord1);
TypesUtils.resetTuple(tupColl1);
TypesUtils.resetTuple(tupColl2);
m1.clear();
bag1.clear();
row = 0;
tupColl1.set(0, "3.3");
tupColl1.set(1, "3.33");
bag1.add(tupColl1);
tupColl2.set(0, "3.333");
tupColl2.set(1, "3.3333");
bag1.add(tupColl2);
tuple2.set(0, bag1);
m1.put("k1", "k13");
m1.put("b", "b3");
m1.put("c", "c3");
tuple2.set(1, m1);
tupRecord1.set(0, "3");
tupRecord1.set(1, "hello3");
tuple2.set(2, tupRecord1);
tuple2.set(3, "world13");
inserter2.insert(new BytesWritable(String
.format("k%d%d", part + 1, row + 1).getBytes()), tuple2);
// second row
row++;
TypesUtils.resetTuple(tuple2);
TypesUtils.resetTuple(tupRecord1);
TypesUtils.resetTuple(tupColl1);
TypesUtils.resetTuple(tupColl2);
bag1.clear();
m1.clear();
row++;
tupColl1.set(0, "4.4");
tupColl1.set(1, "4.44");
bag1.add(tupColl1);
tupColl2.set(0, "4.444");
tupColl2.set(1, "4.4444");
bag1.add(tupColl2);
tuple2.set(0, bag1);
m1.put("k2", "k24");
m1.put("k3", "k34");
m1.put("k1", "k14");
m1.put("k4", "k44");
tuple2.set(1, m1);
tupRecord1.set(0, "4");
tupRecord1.set(1, "hello4");
tuple2.set(2, tupRecord1);
tuple2.set(3, "world4");
inserter2.insert(new BytesWritable(String
.format("k%d%d", part + 1, row + 1).getBytes()), tuple2);
inserter2.close();
writer2.finish();
writer22.close();