From 6171e078c8fdd2250e331f1c225db2b4e3be8809 Mon Sep 17 00:00:00 2001 From: Gian Merlino Date: Thu, 2 Jun 2016 19:59:12 -0700 Subject: [PATCH] Improve NPE message in LookupDimensionSpec when lookup does not exist. (#3065) The message used to be empty, which made things hard to debug. --- .../io/druid/query/dimension/LookupDimensionSpec.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/processing/src/main/java/io/druid/query/dimension/LookupDimensionSpec.java b/processing/src/main/java/io/druid/query/dimension/LookupDimensionSpec.java index fdbd3fa1c32..06d9eb91c8c 100644 --- a/processing/src/main/java/io/druid/query/dimension/LookupDimensionSpec.java +++ b/processing/src/main/java/io/druid/query/dimension/LookupDimensionSpec.java @@ -26,10 +26,10 @@ import com.google.common.base.Preconditions; import com.google.common.base.Strings; import com.metamx.common.StringUtils; import io.druid.query.extraction.ExtractionFn; +import io.druid.query.filter.DimFilterCacheHelper; import io.druid.query.lookup.LookupExtractionFn; import io.druid.query.lookup.LookupExtractor; import io.druid.query.lookup.LookupReferencesManager; -import io.druid.query.filter.DimFilterCacheHelper; import io.druid.segment.DimensionSelector; import javax.annotation.Nullable; @@ -129,10 +129,11 @@ public class LookupDimensionSpec implements DimensionSpec final LookupExtractor lookupExtractor = Strings.isNullOrEmpty(name) ? this.lookup : Preconditions.checkNotNull( - this.lookupReferencesManager.get(name).get(), - "can not find lookup with name [%s]", + lookupReferencesManager.get(name), + "Lookup [%s] not found", name - ); + ).get(); + return new LookupExtractionFn( lookupExtractor, retainMissingValue, @@ -140,7 +141,6 @@ public class LookupDimensionSpec implements DimensionSpec lookupExtractor.isOneToOne(), optimize ); - } @Override