Jackie-Jiang commented on code in PR #16728:
URL: https://github.com/apache/pinot/pull/16728#discussion_r2373774639


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/combine/BaseCombineOperator.java:
##########
@@ -92,26 +96,122 @@ protected BaseCombineOperator(ResultsBlockMerger<T> 
resultsBlockMerger, List<Ope
     _futures = new Future[_numTasks];
   }
 
+  @Override
+  public List<Operator> getChildOperators() {
+    return _operators;
+  }
+
+  /// Do not check termination in combine operator to ensure [#nextBlock()] 
returns a results block instead of
+  /// throwing exception.
+  @Override
+  protected void checkTermination() {
+  }
+
+  /// Replaces the error block with the terminate exception if exists, and 
attaches the execution statistics to the
+  /// results block.
+  protected BaseResultsBlock 
checkTerminateExceptionAndAttachExecutionStats(BaseResultsBlock resultsBlock) {
+    // For exception results block, check terminate exception and use it as 
the results block if exists. We want to
+    // return the termination reason when query is explicitly terminated.
+    if (resultsBlock instanceof ExceptionResultsBlock) {
+      TerminationException terminateException = 
QueryThreadContext.getTerminateException();
+      if (terminateException != null) {
+        resultsBlock = new ExceptionResultsBlock(terminateException);
+      }
+    }
+    return attachExecutionStats(resultsBlock);
+  }
+
+  /// Creates an exception results block from the given throwable, and 
attaches the execution statistics to it.
+  protected BaseResultsBlock 
createExceptionResultsBlockAndAttachExecutionStats(Exception e, String context) 
{
+    // 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.
+    ExceptionResultsBlock resultsBlock;
+    TerminationException terminateException = 
QueryThreadContext.getTerminateException();
+    if (terminateException != null) {
+      resultsBlock = new ExceptionResultsBlock(terminateException);
+    } else {
+      if (e instanceof QueryException) {

Review Comment:
   Good point



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