shauryachats commented on code in PR #17440:
URL: https://github.com/apache/pinot/pull/17440#discussion_r2653580743


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/timeseries/LeafTimeSeriesOperator.java:
##########
@@ -54,13 +57,12 @@ public LeafTimeSeriesOperator(TimeSeriesExecutionContext 
context, ServerQueryReq
   public TimeSeriesBlock getNextBlock() {
     Preconditions.checkNotNull(_queryExecutor, "Leaf time series operator has 
not been initialized");
     InstanceResponseBlock instanceResponseBlock = 
_queryExecutor.execute(_request, _executorService);
-    assert instanceResponseBlock.getResultsBlock() instanceof 
GroupByResultsBlock;
-    _queryLogger.logQuery(_request, instanceResponseBlock, "TimeSeries");
     if (MapUtils.isNotEmpty(instanceResponseBlock.getExceptions())) {
-      // TODO: Return error in the TimeSeriesBlock instead?
-      String message = 
instanceResponseBlock.getExceptions().values().iterator().next();
-      throw new RuntimeException("Error running time-series query: " + 
message);
+      return buildErrorBlock(instanceResponseBlock, "Error running time-series 
query");
     }
+    assert instanceResponseBlock.getResultsBlock() instanceof 
GroupByResultsBlock;
+    _queryLogger.logQuery(_request, instanceResponseBlock, "TimeSeries");

Review Comment:
   `instanceResponseBlock.getResultsBlock()` can return `null` when there are 
exceptions, and the assert can fail before we get a chance to propagate the 
exceptions, hence the exception check is moved before the assert and the 
logQuery.



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