Jibing-Li commented on code in PR #11582:
URL: https://github.com/apache/doris/pull/11582#discussion_r942060667


##########
be/src/vec/exec/scan/scanner_context.cpp:
##########
@@ -0,0 +1,123 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+#include "scanner_context.h"
+
+#include "common/config.h"
+#include "runtime/runtime_state.h"
+#include "util/threadpool.h"
+#include "vec/core/block.h"
+
+namespace doris {
+
+Status ScannerContext::init() {
+    // 1. Calculate how many blocks need to be preallocated.
+    // The calculation logic is as follows:
+    //  1. Assuming that at most M rows can be scanned in one 
scan(config::doris_scanner_row_num),
+    //     then figure out how many blocks are required for one 
scan(block_per_scanner).
+    //  2. The maximum number of concurrency * the blocks required for one 
scan,
+    //     that is, the number of blocks that need to be pre-allocated
+    auto doris_scanner_row_num =
+            limit == -1 ? config::doris_scanner_row_num
+                        : 
std::min(static_cast<int64_t>(config::doris_scanner_row_num), limit);
+    int real_block_size =
+            limit == -1 ? block_size : 
std::min(static_cast<int64_t>(state->batch_size()), limit);

Review Comment:
   the variable `block_size` in ` limit == -1 ? block_size ` is not 
initialized, should we use `state->batch_size()` instead?



-- 
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...@doris.apache.org

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


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

Reply via email to