private int i = 0;
@Override
protected void map(LongWritable key, Text value, Context context)
throws IOException, InterruptedException {
HCatRecord record = null;
String[] splits = value.toString().split(",");
switch (i) {
case 0:
record = new DefaultHCatRecord(2);
record.set(0, splits[0]);
record.set(1, splits[1]);
break;
case 1:
record = new DefaultHCatRecord(1);
record.set(0, splits[0]);
break;
case 2:
record = new DefaultHCatRecord(3);
record.set(0, splits[0]);
record.set(1, splits[1]);
record.set(2, "extra");
break;
default:
Assert.fail("This should not happen!!!!!");
}
MultiOutputFormat.write(tableNames[i], null, record, context);