Improve NPE message in LookupDimensionSpec when lookup does not exist. (#3065)

The message used to be empty, which made things hard to debug.
This commit is contained in:
Gian Merlino 2016-06-02 19:59:12 -07:00 committed by Fangjin Yang
parent 603fbbcc20
commit 6171e078c8
1 changed files with 5 additions and 5 deletions

View File

@ -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