From e6d93a307019406c9e4ec26d9d865fd3717feeb7 Mon Sep 17 00:00:00 2001 From: nishantmonu51 Date: Wed, 17 Sep 2014 15:57:58 +0530 Subject: [PATCH] fix NPE fix NPE when the dimension of metric is not present one of the segments to be reIndexed. --- .../indexing/firehose/IngestSegmentFirehoseFactory.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/indexing-service/src/main/java/io/druid/indexing/firehose/IngestSegmentFirehoseFactory.java b/indexing-service/src/main/java/io/druid/indexing/firehose/IngestSegmentFirehoseFactory.java index 94adbc0f4f1..5744fa7f006 100644 --- a/indexing-service/src/main/java/io/druid/indexing/firehose/IngestSegmentFirehoseFactory.java +++ b/indexing-service/src/main/java/io/druid/indexing/firehose/IngestSegmentFirehoseFactory.java @@ -255,13 +255,18 @@ public class IngestSegmentFirehoseFactory implements FirehoseFactory dimSelectors = Maps.newHashMap(); for (String dim : dims) { final DimensionSelector dimSelector = cursor.makeDimensionSelector(dim); - dimSelectors.put(dim, dimSelector); + // dimSelector is null if the dimension is not present + if (dimSelector != null) { + dimSelectors.put(dim, dimSelector); + } } final Map metSelectors = Maps.newHashMap(); for (String metric : metrics) { final ObjectColumnSelector metricSelector = cursor.makeObjectColumnSelector(metric); - metSelectors.put(metric, metricSelector); + if (metricSelector != null) { + metSelectors.put(metric, metricSelector); + } } return Sequences.simple(