gortiz commented on code in PR #11229:
URL: https://github.com/apache/pinot/pull/11229#discussion_r1280181355


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/pipeline/PipelineBreakerOperator.java:
##########
@@ -70,14 +71,52 @@ public String toExplainString() {
 
   @Override
   protected TransferableBlock getNextBlock() {
-    Pair<Integer, TransferableBlock> pair = _blockConsumer.readBlockBlocking();
-    TransferableBlock block = pair.getRight();
-    if (block.isDataBlock()) {
-      _resultMap.get(pair.getLeft()).add(block);
-      return block;
-    } else if (block.isErrorBlock()) {
-      constructErrorResponse(block);
-      return block;
+    while (!_workerEntries.isEmpty()) {
+      if (_errorBlock != null) {
+        return _errorBlock;
+      }
+      if (System.currentTimeMillis() > _context.getDeadlineMs()) {
+        _errorBlock = 
TransferableBlockUtils.getErrorTransferableBlock(QueryException.EXECUTION_TIMEOUT_ERROR);
+        constructErrorResponse(_errorBlock);
+        return _errorBlock;
+      }
+
+      // Poll from every mailbox operator in round-robin fashion:
+      // - Return the first content block
+      // - If no content block found but there are mailboxes not finished, 
return no-op block
+      // - If all content blocks are already returned, return end-of-stream 
block
+      int numWorkers = _workerEntries.size();
+      for (int i = 0; i < numWorkers; i++) {
+        Map.Entry<Integer, Operator<TransferableBlock>> worker = 
_workerEntries.remove();
+        TransferableBlock block = worker.getValue().nextBlock();

Review Comment:
   This is correct, but here we are blocking on the first operators on the 
queue even if other elements have data



-- 
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: commits-unsubscr...@pinot.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to