From 6a0405de2047c344ec6f3d0f6a61c19b2c146483 Mon Sep 17 00:00:00 2001 From: Himanshu Gupta Date: Sat, 7 Mar 2015 12:45:57 -0600 Subject: [PATCH] fail early if there is no input data for batch hadoop indexing --- .../src/main/java/io/druid/indexer/IndexGeneratorJob.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java b/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java index c944886124d..73634382059 100644 --- a/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java +++ b/indexing-hadoop/src/main/java/io/druid/indexer/IndexGeneratorJob.java @@ -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);