jtuglu1 commented on code in PR #18148:
URL: https://github.com/apache/druid/pull/18148#discussion_r2409863562


##########
processing/src/main/java/org/apache/druid/query/ChainedExecutionQueryRunner.java:
##########
@@ -141,32 +157,33 @@ public Iterable<T> call()
             queryWatcher.registerQueryFuture(query, future);
 
             try {
-              final QueryContext context = query.context();
               return new MergeIterable<>(
                   context.hasTimeout() ?
                       future.get(context.getTimeout(), TimeUnit.MILLISECONDS) :
                       future.get(),
                   ordering.nullsFirst()
               ).iterator();
             }
-            catch (InterruptedException e) {
-              log.noStackTrace().warn(e, "Query interrupted, cancelling 
pending results, query id [%s]", query.getId());
-              //Note: canceling combinedFuture first so that it can complete 
with INTERRUPTED as its final state. See 
ChainedExecutionQueryRunnerTest.testQueryTimeout()
+            catch (CancellationException | InterruptedException e) {
+              log.noStackTrace().warn(e, "Query interrupted, cancelling 
pending results for query [%s]", query.getId());
               GuavaUtils.cancelAll(true, future, futures);
               throw new QueryInterruptedException(e);
             }
-            catch (CancellationException e) {
-              throw new QueryInterruptedException(e);
-            }
-            catch (TimeoutException e) {
-              log.warn("Query timeout, cancelling pending results for query id 
[%s]", query.getId());
+            catch (TimeoutException | QueryTimeoutException e) {
+              log.noStackTrace().warn(e, "Query timeout, cancelling pending 
results for query [%s]", query.getId());
               GuavaUtils.cancelAll(true, future, futures);
               throw new 
QueryTimeoutException(StringUtils.nonStrictFormat("Query [%s] timed out", 
query.getId()));
             }
             catch (ExecutionException e) {
+              log.noStackTrace().warn(e, "Query error, cancelling pending 
results for query [%s]", query.getId());
               GuavaUtils.cancelAll(true, future, futures);
-              Throwables.propagateIfPossible(e.getCause());
-              throw new RuntimeException(e.getCause());
+              Throwable cause = e.getCause();
+              // Nested per-segment future timeout
+              if (cause instanceof TimeoutException) {

Review Comment:
   Yes. This depends on whether the query is being executed in direct mode as 
well (but that's not really relevant here).



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