Description
Upon checking the available utility methods in TableMapReduceUtil I came across this code
public static void initTableReduceJob(String table, Class<? extends TableReduce> reducer, JobConf job, Class partitioner) throws IOException { job.setOutputFormat(TableOutputFormat.class); job.setReducerClass(reducer); job.set(TableOutputFormat.OUTPUT_TABLE, table); job.setOutputKeyClass(ImmutableBytesWritable.class); job.setOutputValueClass(BatchUpdate.class); if (partitioner != null) { job.setPartitionerClass(HRegionPartitioner.class); HTable outputTable = new HTable(new HBaseConfiguration(job), table); int regions = outputTable.getRegionsInfo().size(); if (job.getNumReduceTasks() > regions){ job.setNumReduceTasks(outputTable.getRegionsInfo().size()); } } }
It seems though as it should be
if (partitioner != null) { job.setPartitionerClass(partitioner);
and the provided HRegionPartitioner can be handed in to that call or a custom one can be provided.