FrankChen021 commented on code in PR #20183:
URL: https://github.com/apache/druid/pull/20183#discussion_r4325154670


##########
server/src/main/java/org/apache/druid/server/QueryLifecycle.java:
##########
@@ -420,13 +465,58 @@ public <T> QueryResponse<T> execute()
     final ResponseContext responseContext = 
DirectDruidClient.makeResponseContextForQuery();
 
     @SuppressWarnings("unchecked")
-    final Sequence<T> res = QueryPlus.wrap((Query<T>) baseQuery)
-                                     
.withIdentity(authenticationResult.getIdentity())
-                                     .run(texasRanger, responseContext);
+    final Query<T> originalQuery = (Query<T>) baseQuery;
+    final DataSourceQueryHandler dataSourceQueryHandler = 
findDataSourceQueryHandler(originalQuery.getDataSource());
+    // Handlers can start fanout or provider work before reaching a segment 
walker, or bypass it entirely.
+    // Apply the same server guardrails first, and pass the normalized query 
to both runner creation and execution.
+    final Query<T> query = dataSourceQueryHandler == null
+                           ? originalQuery
+                           : 
SetAndVerifyContextQueryRunner.withTimeoutAndMaxScatterGatherBytes(
+                               originalQuery,
+                               serverConfig,
+                               System.currentTimeMillis()
+                           );
+    final QueryRunner<T> queryRunner = dataSourceQueryHandler == null
+                                       ? query.getRunner(texasRanger)
+                                       : dataSourceQueryHandler.createRunner(

Review Comment:
   [P2] Register handler queries for cancellation
   
   **Finding:** Handler-backed native system-table queries bypass 
QueryScheduler registration. QueryResource cancellation therefore cannot 
resolve the user-facing query ID, while generated child requests and local 
provider work continue independently.
   
   **Suggestion:** Register the handler's top-level execution or an equivalent 
parent cancellation handle with QueryScheduler using the user query ID, and 
ensure cancellation closes NodeSequencesCloser, local/provider work, and 
generated child futures.



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