Copilot commented on code in PR #17009:
URL: https://github.com/apache/pinot/pull/17009#discussion_r2427568120


##########
pinot-core/src/main/java/org/apache/pinot/core/query/reduce/BrokerReduceService.java:
##########
@@ -173,17 +172,16 @@ public BrokerResponseNative 
reduceOnDataTable(BrokerRequest brokerRequest, Broke
     } catch (RuntimeException e) {
       // First check terminate exception and use it as the results block if 
exists. We want to return the termination
       // reason when query is explicitly terminated.
-      TerminationException terminateException = 
QueryThreadContext.getTerminateException();
-      if (terminateException != null) {
-        
brokerResponseNative.addException(QueryProcessingException.fromQueryException(terminateException));
+      QueryException queryException = 
QueryThreadContext.getTerminateException();
+      if (queryException == null && e instanceof QueryException) {
+        queryException = (QueryException) e;
+      }
+      if (queryException != null) {
+        
brokerResponseNative.addException(QueryProcessingException.fromQueryException((QueryException)
 e));

Review Comment:
   The code is using variable `e` instead of `queryException` when creating the 
QueryProcessingException. It should use `queryException` since that's the 
exception being checked and could be either the terminate exception or the 
original exception.
   ```suggestion
           
brokerResponseNative.addException(QueryProcessingException.fromQueryException(queryException));
   ```



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