github-actions[bot] commented on code in PR #62222:
URL: https://github.com/apache/doris/pull/62222#discussion_r3165282992


##########
be/src/exec/scan/scanner_scheduler.cpp:
##########
@@ -211,9 +211,8 @@ void 
ScannerScheduler::_scanner_scan(std::shared_ptr<ScannerContext> ctx,
             }
 
             bool first_read = true;
-            int64_t limit = scanner->limit(); if (UNLIKELY(ctx->done())) {
-                eos = true;
-            } else if (ctx->remaining_limit() == 0) { eos = true; } else if 
(!eos) {
+            int64_t limit = scanner->limit();
+            if (UNLIKELY(ctx->done())) { eos = true; } else if (!eos) {
                 do {

Review Comment:
   This branch still allows a pending scanner to run after the shared LIMIT 
budget has been overshot below zero. `Scanner::get_block()` subtracts the whole 
returned block with `fetch_sub`, so a common case like `LIMIT 10` with a 
4096-row block makes `_shared_scan_limit` negative. `_pull_next_scan_task()` 
only skips exactly `0`, and this branch only checks `ctx->done()`, so another 
pending scanner can be prepared/opened and then immediately hit 
`Scanner::get_block()`'s `<= 0` early EOF with an empty block. The scheduler 
still stores that empty block in `scan_task->cached_block`; 
`ScannerContext::get_block_from_queue()` returns cached blocks before checking 
`scan_task->is_eos()`, so that scanner completion is never counted and the 
dependency can remain blocked. This is distinct from the `LIMIT 0` startup path 
because it happens after any produced block overshoots a small positive LIMIT. 
Please either clamp the shared counter at 0 or consistently treat `<= 0` as 
exhausted before schedul
 ing/reading, so no empty EOF task is cached and dropped.



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