You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2023/01/16 11:32:52 UTC

[doris] branch master updated: [enhancement](profile) add read columns to scanner profile (#15902)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new bdec4d5ac2 [enhancement](profile) add read columns to scanner profile (#15902)
bdec4d5ac2 is described below

commit bdec4d5ac291c90d5629f1b8d08060e58ba1aa85
Author: WenYao <72...@qq.com>
AuthorDate: Mon Jan 16 19:32:46 2023 +0800

    [enhancement](profile) add read columns to scanner profile (#15902)
---
 be/src/olap/rowset/beta_rowset_reader.cpp |  7 +++++++
 be/src/olap/rowset/beta_rowset_reader.h   |  7 +------
 be/src/vec/exec/scan/new_olap_scanner.cpp | 20 ++++++++++++++++++++
 3 files changed, 28 insertions(+), 6 deletions(-)

diff --git a/be/src/olap/rowset/beta_rowset_reader.cpp b/be/src/olap/rowset/beta_rowset_reader.cpp
index 7a41302d3e..c56345eacb 100644
--- a/be/src/olap/rowset/beta_rowset_reader.cpp
+++ b/be/src/olap/rowset/beta_rowset_reader.cpp
@@ -42,6 +42,13 @@ void BetaRowsetReader::reset_read_options() {
     _read_options.key_ranges.clear();
 }
 
+bool BetaRowsetReader::update_profile(RuntimeProfile* profile) {
+    if (_iterator != nullptr) {
+        return _iterator->update_profile(profile);
+    }
+    return false;
+}
+
 Status BetaRowsetReader::get_segment_iterators(RowsetReaderContext* read_context,
                                                std::vector<RowwiseIterator*>* out_iters) {
     RETURN_NOT_OK(_rowset->load());
diff --git a/be/src/olap/rowset/beta_rowset_reader.h b/be/src/olap/rowset/beta_rowset_reader.h
index 5082be1ee8..889a7c2742 100644
--- a/be/src/olap/rowset/beta_rowset_reader.h
+++ b/be/src/olap/rowset/beta_rowset_reader.h
@@ -64,12 +64,7 @@ public:
 
     Status get_segment_num_rows(std::vector<uint32_t>* segment_num_rows) override;
 
-    bool update_profile(RuntimeProfile* profile) override {
-        if (_iterator != nullptr) {
-            return _iterator->update_profile(profile);
-        }
-        return false;
-    }
+    bool update_profile(RuntimeProfile* profile) override;
 
 private:
     bool _should_push_down_value_predicates() const;
diff --git a/be/src/vec/exec/scan/new_olap_scanner.cpp b/be/src/vec/exec/scan/new_olap_scanner.cpp
index dc5038d049..100a8fd587 100644
--- a/be/src/vec/exec/scan/new_olap_scanner.cpp
+++ b/be/src/vec/exec/scan/new_olap_scanner.cpp
@@ -33,6 +33,20 @@ NewOlapScanner::NewOlapScanner(RuntimeState* state, NewOlapScanNode* parent, int
     _tablet_schema = std::make_shared<TabletSchema>();
 }
 
+static std::string read_columns_to_string(TabletSchemaSPtr tablet_schema,
+                                          const std::vector<uint32_t>& read_columns) {
+    std::string read_columns_string;
+    read_columns_string += "[";
+    for (auto it = read_columns.cbegin(); it != read_columns.cend(); it++) {
+        if (it != read_columns.cbegin()) {
+            read_columns_string += ", ";
+        }
+        read_columns_string += tablet_schema->columns().at(*it).name();
+    }
+    read_columns_string += "]";
+    return read_columns_string;
+}
+
 Status NewOlapScanner::prepare(const TPaloScanRange& scan_range,
                                const std::vector<OlapScanRange*>& key_ranges,
                                VExprContext** vconjunct_ctx_ptr,
@@ -108,6 +122,12 @@ Status NewOlapScanner::prepare(const TPaloScanRange& scan_range,
         }
     }
 
+    // add read columns in profile
+    if (_state->enable_profile()) {
+        _profile->add_info_string("ReadColumns",
+                                  read_columns_to_string(_tablet_schema, _return_columns));
+    }
+
     return Status::OK();
 }
 


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