Skip to content

Commit

Permalink
fix npe in CachingQueryRunner
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrl committed Apr 10, 2014
1 parent c05f169 commit 69a8723
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions server/src/main/java/io/druid/client/CachingQueryRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,16 @@ public Sequence<T> run(Query<T> query)
&& 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();
Expand Down

0 comments on commit 69a8723

Please sign in to comment.