HappenLee commented on code in PR #47501:
URL: https://github.com/apache/doris/pull/47501#discussion_r1945935443


##########
be/src/pipeline/exec/olap_scan_operator.cpp:
##########
@@ -410,20 +388,67 @@ Status 
OlapScanLocalState::_init_scanners(std::list<vectorized::VScannerSPtr>* s
                                   state(),
                                   _scanner_profile.get(),
                                   scanner_ranges,
-                                  tablet,
+                                  _tablets[scan_range_idx].tablet,
                                   version,
-                                  {},
+                                  _read_sources[scan_range_idx],
                                   p._limit,
                                   p._olap_scan_node.is_preaggregation,
                           });
             RETURN_IF_ERROR(scanner->prepare(state(), _conjuncts));
             scanners->push_back(std::move(scanner));
         }
     }
+    _tablets.clear();
+    _read_sources.clear();
 
     return Status::OK();
 }
 
+Status OlapScanLocalState::hold_tablets() {
+    if (!_tablets.empty()) {
+        return Status::OK();
+    }
+    _tablets.resize(_scan_ranges.size());
+    _read_sources.resize(_scan_ranges.size());
+    for (size_t i = 0; i < _scan_ranges.size(); i++) {
+        int64_t version = 0;
+        std::from_chars(_scan_ranges[i]->version.data(),
+                        _scan_ranges[i]->version.data() + 
_scan_ranges[i]->version.size(), version);
+        auto tablet = 
DORIS_TRY(ExecEnv::get_tablet(_scan_ranges[i]->tablet_id));
+        _tablets[i] = {std::move(tablet), version};
+        if (config::is_cloud_mode()) {
+            int64_t duration_ns = 0;
+            {
+                SCOPED_RAW_TIMER(&duration_ns);
+                std::vector<std::function<Status()>> tasks;
+                tasks.reserve(_scan_ranges.size());
+                for (auto&& [cur_tablet, cur_version] : _tablets) {
+                    tasks.emplace_back([cur_tablet, cur_version]() {
+                        return 
std::dynamic_pointer_cast<CloudTablet>(cur_tablet)
+                                ->sync_rowsets(cur_version);
+                    });
+                }
+                RETURN_IF_ERROR(cloud::bthread_fork_join(tasks, 10));
+            }
+            _sync_rowset_timer->update(duration_ns);
+        }
+
+        if (config::is_cloud_mode()) {
+            // FIXME(plat1ko): Avoid pointer cast
+            
ExecEnv::GetInstance()->storage_engine().to_cloud().tablet_hotspot().count(
+                    *_tablets[i].tablet);
+        }
+
+        RETURN_IF_ERROR(_tablets[i].tablet->capture_rs_readers(
+                {0, version}, &_read_sources[i].rs_splits,
+                RuntimeFilterConsumer::_state->skip_missing_version()));

Review Comment:
   why here need RuntimeFilterConsumer?seems wired?why not directly `_state `



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