* @return hive record
*/
public static HiveWritableRecord mapToHiveRecord(Configuration conf, MapWritable value) {
try {
HiveTableSchema schema = HiveTableSchemas.lookup(conf, getHiveTableName());
HiveWritableRecord record = HiveRecordFactory.newWritableRecord(schema);
for (Map.Entry<Writable, Writable> entry : value.entrySet()) {
IntWritable intKey = (IntWritable) entry.getKey();
LongWritable longValue = (LongWritable) entry.getValue();
record.set(intKey.get(), longValue.get());
}
return record;
} catch (IOException e) {
throw new IllegalStateException(e);
}