This is an automated email from the ASF dual-hosted git repository.

mrhhsg pushed a commit to branch spill_and_reserve
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/spill_and_reserve by this push:
     new bae7a48cc01 [fix] _max_scanners should greater than 0
bae7a48cc01 is described below

commit bae7a48cc01db209dce6b15439ad436ac5bb4ed9
Author: Hu Shenggang <hushengg...@selectdb.com>
AuthorDate: Mon Jan 6 22:31:22 2025 +0800

    [fix] _max_scanners should greater than 0
---
 be/src/pipeline/exec/file_scan_operator.cpp | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/be/src/pipeline/exec/file_scan_operator.cpp 
b/be/src/pipeline/exec/file_scan_operator.cpp
index afd548f35f4..5d83d5beeb2 100644
--- a/be/src/pipeline/exec/file_scan_operator.cpp
+++ b/be/src/pipeline/exec/file_scan_operator.cpp
@@ -65,15 +65,19 @@ void FileScanLocalState::set_scan_ranges(RuntimeState* 
state,
             config::doris_scanner_thread_pool_thread_num / 
state->query_parallel_instance_num();
     if (wg_ptr) {
         const auto total_slots = wg_ptr->total_query_slot_count();
-        const auto query_slots = state->get_query_ctx()->get_slot_count();
-        _max_scanners = _max_scanners * query_slots / total_slots;
+        if (total_slots > 0) {
+            const auto query_slots = 
std::max<int32_t>(state->get_query_ctx()->get_slot_count(), 1);
+            _max_scanners = _max_scanners * query_slots / total_slots;
+        }
     }
 
     const auto parallel_scan_max_scanners_count = 
state->parallel_scan_max_scanners_count();
     if (parallel_scan_max_scanners_count > 0) {
-        _max_scanners =
-                std::max(std::min(_max_scanners, 
state->parallel_scan_max_scanners_count()), 1);
+        _max_scanners = std::min(_max_scanners, 
state->parallel_scan_max_scanners_count());
     }
+
+    _max_scanners = std::max(_max_scanners, 1);
+    DCHECK_GT(_max_scanners, 0);
     // For select * from table limit 10; should just use one thread.
     if (should_run_serial()) {
         _max_scanners = 1;


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

Reply via email to