fail early if there is no input data for batch hadoop indexing

This commit is contained in:
Himanshu Gupta 2015-03-07 12:45:57 -06:00
parent a54f93ea42
commit 6a0405de20
1 changed files with 5 additions and 1 deletions

View File

@ -169,7 +169,11 @@ public class IndexGeneratorJob implements Jobby
SortableBytes.useSortableBytesAsMapOutputKey(job);
job.setNumReduceTasks(Iterables.size(config.getAllBuckets().get()));
int numReducers = Iterables.size(config.getAllBuckets().get());
if(numReducers == 0) {
throw new RuntimeException("No buckets?? seems there is no data to index.");
}
job.setNumReduceTasks(numReducers);
job.setPartitionerClass(IndexGeneratorPartitioner.class);
setReducerClass(job);