job.setOutputFormat(HBaseDirectOutputFormat.class);
job.set(TableOutputFormat.OUTPUT_TABLE, tableName);
job.set(HBaseConstants.PROPERTY_OUTPUT_TABLE_NAME_KEY, tableName);
//manually create transaction
RevisionManager rm = HBaseRevisionManagerUtil.getOpenedRevisionManager(conf);
try {
OutputJobInfo outputJobInfo = OutputJobInfo.create("default", tableName, null);
Transaction txn = rm.beginWriteTransaction(tableName, Arrays.asList(familyName));
outputJobInfo.getProperties().setProperty(HBaseConstants.PROPERTY_WRITE_TXN_KEY,
HCatUtil.serialize(txn));
job.set(HCatConstants.HCAT_KEY_OUTPUT_INFO,
HCatUtil.serialize(outputJobInfo));
} finally {
rm.close();
}
job.setMapOutputKeyClass(BytesWritable.class);
job.setMapOutputValueClass(HCatRecord.class);
job.setOutputKeyClass(BytesWritable.class);