jtuglu-netflix commented on code in PR #18063:
URL: https://github.com/apache/druid/pull/18063#discussion_r2173547686


##########
server/src/main/java/org/apache/druid/query/ResultLevelCachingQueryRunner.java:
##########
@@ -97,83 +102,88 @@ public Sequence<T> run(QueryPlus queryPlus, 
ResponseContext responseContext)
       existingResultSetId = existingResultSetId == null ? "" : 
existingResultSetId;
       query = query.withOverriddenContext(
           ImmutableMap.of(QueryResource.HEADER_IF_NONE_MATCH, 
existingResultSetId));
-
       Sequence<T> resultFromClient = baseRunner.run(
           QueryPlus.wrap(query),
           responseContext
       );
       String newResultSetId = responseContext.getEntityTag();
 
-      if (useResultCache && newResultSetId != null && 
newResultSetId.equals(existingResultSetId)) {
-        log.debug("Return cached result set as there is no change in 
identifiers for query %s ", query.getId());
-        // Call accumulate on the sequence to ensure that all 
Wrapper/Closer/Baggage/etc. get called
-        resultFromClient.accumulate(null, (accumulated, in) -> accumulated);
-        return deserializeResults(cachedResultSet, strategy, 
existingResultSetId);
-      } else {
-        @Nullable
-        ResultLevelCachePopulator resultLevelCachePopulator = 
createResultLevelCachePopulator(
-            cacheKey,
-            newResultSetId
-        );
-        if (resultLevelCachePopulator == null) {
-          return resultFromClient;
+      if (useResultCache) {
+        final boolean cacheHit = newResultSetId != null && 
newResultSetId.equals(existingResultSetId);

Review Comment:
   Sure – I just didn't really like the idea of flattening the logic tree that 
should only execute if we're using result cache into a top-level list of N (IMO 
less-readable) ifs. I've updated.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to