jihoonson commented on a change in pull request #10027:
URL: https://github.com/apache/druid/pull/10027#discussion_r446303931



##########
File path: core/src/main/java/org/apache/druid/common/guava/GuavaUtils.java
##########
@@ -23,8 +23,8 @@
 import com.google.common.base.Strings;
 import com.google.common.primitives.Longs;
 import org.apache.druid.java.util.common.logger.Logger;
-
 import javax.annotation.Nullable;
+import java.util.ArrayList;

Review comment:
       ```[ERROR] 
/home/travis/build/apache/druid/core/src/main/java/org/apache/druid/common/guava/GuavaUtils.java:26:
 'javax.annotation.Nullable' should be separated from previous imports. 
[ImportOrder]```
   
   The checkstyle wants an empty line between the Lines 26 and 27.

##########
File path: 
processing/src/main/java/org/apache/druid/query/ChainedExecutionQueryRunner.java
##########
@@ -141,33 +144,34 @@ public ChainedExecutionQueryRunner(
                           );
                         }
                     )
-                )
-            );
+                );
 
-            queryWatcher.registerQueryFuture(query, futures);
+            ListenableFuture<List<Iterable<T>>> future = 
Futures.allAsList(futures);
+            queryWatcher.registerQueryFuture(query, future);
 
             try {
               return new MergeIterable<>(
                   ordering.nullsFirst(),
                   QueryContexts.hasTimeout(query) ?
-                      futures.get(QueryContexts.getTimeout(query), 
TimeUnit.MILLISECONDS) :
-                      futures.get()
+                      future.get(QueryContexts.getTimeout(query), 
TimeUnit.MILLISECONDS) :
+                      future.get()
               ).iterator();
             }
             catch (InterruptedException e) {
               log.noStackTrace().warn(e, "Query interrupted, cancelling 
pending results, query id [%s]", query.getId());
-              futures.cancel(true);
+              GuavaUtils.cancelAll(true, 
ImmutableList.<Future>builder().add(future).addAll(futures).build());

Review comment:
       Ah makes sense 👍. Would you please add a comment on [this 
line](https://github.com/apache/druid/pull/10027/files/7fc9d5036af8003f1a576ccab128b57571ad03fd..a51d7e16f5f15af33fa239419aaa82bffb99f8f5#diff-298d22d65226e0f32251f009130a0032R102)
 about why we cancel it first? It would help other people to understand your 
intention. Maybe the comment can say "Canceling combinedFuture first so that it 
can complete with `INTERRUPTED` as its final state. See 
ChainedExecutionQueryRunnerTest.testQueryTimeout()".




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

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