diff --git a/server/src/main/java/io/druid/client/CachingQueryRunner.java b/server/src/main/java/io/druid/client/CachingQueryRunner.java index 2b198c2fb57..d92db6415fb 100644 --- a/server/src/main/java/io/druid/client/CachingQueryRunner.java +++ b/server/src/main/java/io/druid/client/CachingQueryRunner.java @@ -84,11 +84,16 @@ public class CachingQueryRunner implements QueryRunner && strategy != null && cacheConfig.isPopulateCache(); - final Cache.NamedKey key = CacheUtil.computeSegmentCacheKey( - segmentIdentifier, - segmentDescriptor, - strategy.computeCacheKey(query) - ); + final Cache.NamedKey key; + if(strategy != null && (useCache || populateCache)) { + key = CacheUtil.computeSegmentCacheKey( + segmentIdentifier, + segmentDescriptor, + strategy.computeCacheKey(query) + ); + } else { + key = null; + } if(useCache) { final Function cacheFn = strategy.pullFromCache();