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

yiguolei pushed a commit to branch branch-4.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.0 by this push:
     new 83fa87afc4d branch-4.0: [Improvement](scanner) Include open() time in 
PerScannerRunningTime #61042 (#61101)
83fa87afc4d is described below

commit 83fa87afc4d09898a0cbd0a276589e064e07b1ba
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Mar 7 15:33:27 2026 +0800

    branch-4.0: [Improvement](scanner) Include open() time in 
PerScannerRunningTime #61042 (#61101)
    
    Cherry-picked from #61042
    
    Co-authored-by: HappenLee <[email protected]>
---
 be/src/vec/exec/scan/es_scanner.cpp   |  4 ++--
 be/src/vec/exec/scan/es_scanner.h     |  2 +-
 be/src/vec/exec/scan/file_scanner.cpp |  4 ++--
 be/src/vec/exec/scan/file_scanner.h   |  2 +-
 be/src/vec/exec/scan/jdbc_scanner.cpp |  4 ++--
 be/src/vec/exec/scan/jdbc_scanner.h   |  2 +-
 be/src/vec/exec/scan/meta_scanner.cpp |  4 ++--
 be/src/vec/exec/scan/meta_scanner.h   |  2 +-
 be/src/vec/exec/scan/olap_scanner.cpp |  4 ++--
 be/src/vec/exec/scan/olap_scanner.h   |  2 +-
 be/src/vec/exec/scan/scanner.h        | 12 +++++++++---
 11 files changed, 24 insertions(+), 18 deletions(-)

diff --git a/be/src/vec/exec/scan/es_scanner.cpp 
b/be/src/vec/exec/scan/es_scanner.cpp
index 1376fd1dbf7..d93dbdecc02 100644
--- a/be/src/vec/exec/scan/es_scanner.cpp
+++ b/be/src/vec/exec/scan/es_scanner.cpp
@@ -78,7 +78,7 @@ Status EsScanner::init(RuntimeState* state, const 
VExprContextSPtrs& conjuncts)
     return Status::OK();
 }
 
-Status EsScanner::open(RuntimeState* state) {
+Status EsScanner::_open_impl(RuntimeState* state) {
     VLOG_CRITICAL << NEW_SCANNER_TYPE << "::open";
 
     if (nullptr == state) {
@@ -90,7 +90,7 @@ Status EsScanner::open(RuntimeState* state) {
     }
 
     RETURN_IF_CANCELLED(state);
-    RETURN_IF_ERROR(Scanner::open(state));
+    RETURN_IF_ERROR(Scanner::_open_impl(state));
 
     RETURN_IF_ERROR(_es_reader->open());
 
diff --git a/be/src/vec/exec/scan/es_scanner.h 
b/be/src/vec/exec/scan/es_scanner.h
index 05ee6663baa..14c2b017f24 100644
--- a/be/src/vec/exec/scan/es_scanner.h
+++ b/be/src/vec/exec/scan/es_scanner.h
@@ -54,7 +54,7 @@ public:
               const std::map<std::string, std::string>& docvalue_context, bool 
doc_value_mode,
               RuntimeProfile* profile);
 
-    Status open(RuntimeState* state) override;
+    Status _open_impl(RuntimeState* state) override;
     Status close(RuntimeState* state) override;
     Status init(RuntimeState* state, const VExprContextSPtrs& conjuncts) 
override;
 
diff --git a/be/src/vec/exec/scan/file_scanner.cpp 
b/be/src/vec/exec/scan/file_scanner.cpp
index 4b9535df259..5124f8ea631 100644
--- a/be/src/vec/exec/scan/file_scanner.cpp
+++ b/be/src/vec/exec/scan/file_scanner.cpp
@@ -382,9 +382,9 @@ void FileScanner::_get_slot_ids(VExpr* expr, 
std::vector<int>* slot_ids) {
     }
 }
 
-Status FileScanner::open(RuntimeState* state) {
+Status FileScanner::_open_impl(RuntimeState* state) {
     RETURN_IF_CANCELLED(state);
-    RETURN_IF_ERROR(Scanner::open(state));
+    RETURN_IF_ERROR(Scanner::_open_impl(state));
     RETURN_IF_ERROR(_split_source->get_next(&_first_scan_range, 
&_current_range));
     if (_first_scan_range) {
         RETURN_IF_ERROR(_init_expr_ctxes());
diff --git a/be/src/vec/exec/scan/file_scanner.h 
b/be/src/vec/exec/scan/file_scanner.h
index f8b68200806..7bce9f5f200 100644
--- a/be/src/vec/exec/scan/file_scanner.h
+++ b/be/src/vec/exec/scan/file_scanner.h
@@ -71,7 +71,7 @@ public:
                 RuntimeProfile* profile, ShardedKVCache* kv_cache,
                 const std::unordered_map<std::string, int>* 
colname_to_slot_id);
 
-    Status open(RuntimeState* state) override;
+    Status _open_impl(RuntimeState* state) override;
 
     Status close(RuntimeState* state) override;
 
diff --git a/be/src/vec/exec/scan/jdbc_scanner.cpp 
b/be/src/vec/exec/scan/jdbc_scanner.cpp
index 4b3ee9cf7f0..d64addfb497 100644
--- a/be/src/vec/exec/scan/jdbc_scanner.cpp
+++ b/be/src/vec/exec/scan/jdbc_scanner.cpp
@@ -101,7 +101,7 @@ Status JdbcScanner::init(RuntimeState* state, const 
VExprContextSPtrs& conjuncts
     return Status::OK();
 }
 
-Status JdbcScanner::open(RuntimeState* state) {
+Status JdbcScanner::_open_impl(RuntimeState* state) {
     VLOG_CRITICAL << "JdbcScanner::open";
     if (state == nullptr) {
         return Status::InternalError("input pointer is NULL of 
VJdbcScanNode::open.");
@@ -111,7 +111,7 @@ Status JdbcScanner::open(RuntimeState* state) {
         return Status::InternalError("used before initialize of 
VJdbcScanNode::open.");
     }
     RETURN_IF_CANCELLED(state);
-    RETURN_IF_ERROR(Scanner::open(state));
+    RETURN_IF_ERROR(Scanner::_open_impl(state));
     RETURN_IF_ERROR(_jdbc_connector->open(state, true));
     RETURN_IF_ERROR(_jdbc_connector->query());
     return Status::OK();
diff --git a/be/src/vec/exec/scan/jdbc_scanner.h 
b/be/src/vec/exec/scan/jdbc_scanner.h
index 31f7b9abee3..f19d8f9098d 100644
--- a/be/src/vec/exec/scan/jdbc_scanner.h
+++ b/be/src/vec/exec/scan/jdbc_scanner.h
@@ -48,7 +48,7 @@ public:
     JdbcScanner(RuntimeState* state, doris::pipeline::JDBCScanLocalState* 
parent, int64_t limit,
                 const TupleId& tuple_id, const std::string& query_string,
                 TOdbcTableType::type table_type, bool is_tvf, RuntimeProfile* 
profile);
-    Status open(RuntimeState* state) override;
+    Status _open_impl(RuntimeState* state) override;
     Status close(RuntimeState* state) override;
 
     Status init(RuntimeState* state, const VExprContextSPtrs& conjuncts) 
override;
diff --git a/be/src/vec/exec/scan/meta_scanner.cpp 
b/be/src/vec/exec/scan/meta_scanner.cpp
index 1cc20a3d11b..4f5da317947 100644
--- a/be/src/vec/exec/scan/meta_scanner.cpp
+++ b/be/src/vec/exec/scan/meta_scanner.cpp
@@ -64,9 +64,9 @@ MetaScanner::MetaScanner(RuntimeState* state, 
pipeline::ScanLocalStateBase* loca
           _user_identity(user_identity),
           _scan_range(scan_range.scan_range) {}
 
-Status MetaScanner::open(RuntimeState* state) {
+Status MetaScanner::_open_impl(RuntimeState* state) {
     VLOG_CRITICAL << "MetaScanner::open";
-    RETURN_IF_ERROR(Scanner::open(state));
+    RETURN_IF_ERROR(Scanner::_open_impl(state));
     if (_scan_range.meta_scan_range.metadata_type == TMetadataType::ICEBERG) {
         // TODO: refactor this code
         auto reader = 
IcebergSysTableJniReader::create_unique(_tuple_desc->slots(), state, _profile,
diff --git a/be/src/vec/exec/scan/meta_scanner.h 
b/be/src/vec/exec/scan/meta_scanner.h
index 8d62ef95bd2..1ea3b0f5d48 100644
--- a/be/src/vec/exec/scan/meta_scanner.h
+++ b/be/src/vec/exec/scan/meta_scanner.h
@@ -54,7 +54,7 @@ public:
                 const TScanRangeParams& scan_range, int64_t limit, 
RuntimeProfile* profile,
                 TUserIdentity user_identity);
 
-    Status open(RuntimeState* state) override;
+    Status _open_impl(RuntimeState* state) override;
     Status close(RuntimeState* state) override;
     Status init(RuntimeState* state, const VExprContextSPtrs& conjuncts) 
override;
 
diff --git a/be/src/vec/exec/scan/olap_scanner.cpp 
b/be/src/vec/exec/scan/olap_scanner.cpp
index 46fe48e0bf1..88e08ae7706 100644
--- a/be/src/vec/exec/scan/olap_scanner.cpp
+++ b/be/src/vec/exec/scan/olap_scanner.cpp
@@ -305,8 +305,8 @@ Status OlapScanner::prepare() {
     return Status::OK();
 }
 
-Status OlapScanner::open(RuntimeState* state) {
-    RETURN_IF_ERROR(Scanner::open(state));
+Status OlapScanner::_open_impl(RuntimeState* state) {
+    RETURN_IF_ERROR(Scanner::_open_impl(state));
     
SCOPED_TIMER(_local_state->cast<pipeline::OlapScanLocalState>()._reader_init_timer);
 
     auto res = _tablet_reader->init(_tablet_reader_params);
diff --git a/be/src/vec/exec/scan/olap_scanner.h 
b/be/src/vec/exec/scan/olap_scanner.h
index 4b8d866ba25..8870cc9d7a1 100644
--- a/be/src/vec/exec/scan/olap_scanner.h
+++ b/be/src/vec/exec/scan/olap_scanner.h
@@ -75,7 +75,7 @@ public:
 
     Status prepare() override;
 
-    Status open(RuntimeState* state) override;
+    Status _open_impl(RuntimeState* state) override;
 
     Status close(RuntimeState* state) override;
 
diff --git a/be/src/vec/exec/scan/scanner.h b/be/src/vec/exec/scan/scanner.h
index 060c5db9449..dec0349c8fc 100644
--- a/be/src/vec/exec/scan/scanner.h
+++ b/be/src/vec/exec/scan/scanner.h
@@ -78,9 +78,10 @@ public:
         _has_prepared = true;
         return Status::OK();
     }
-    virtual Status open(RuntimeState* state) {
-        _block_avg_bytes = state->batch_size() * 8;
-        return Status::OK();
+
+    Status open(RuntimeState* state) {
+        SCOPED_RAW_TIMER(&_per_scanner_timer);
+        return _open_impl(state);
     }
 
     Status get_block(RuntimeState* state, Block* block, bool* eos);
@@ -98,6 +99,11 @@ public:
     virtual std::string get_current_scan_range_name() { return "not 
implemented"; }
 
 protected:
+    virtual Status _open_impl(RuntimeState* state) {
+        _block_avg_bytes = state->batch_size() * 8;
+        return Status::OK();
+    }
+
     // Subclass should implement this to return data.
     virtual Status _get_block_impl(RuntimeState* state, Block* block, bool* 
eof) = 0;
 


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to