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

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


The following commit(s) were added to refs/heads/branch-2.0 by this push:
     new b95e7debd6 Remove redundant predicates on scan node (#23476)
b95e7debd6 is described below

commit b95e7debd6201f3f27d9ab16d46447f148e4ae9c
Author: Pxl <[email protected]>
AuthorDate: Fri Aug 25 12:52:08 2023 +0800

    Remove redundant predicates on scan node (#23476)
---
 be/src/vec/exec/scan/new_olap_scan_node.cpp | 10 +---------
 be/src/vec/exec/scan/new_olap_scan_node.h   | 11 ++++++++++-
 be/src/vec/exec/scan/vscan_node.cpp         |  3 ++-
 be/src/vec/exec/scan/vscan_node.h           |  2 ++
 4 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/be/src/vec/exec/scan/new_olap_scan_node.cpp 
b/be/src/vec/exec/scan/new_olap_scan_node.cpp
index d6a72d49a1..13b8e92119 100644
--- a/be/src/vec/exec/scan/new_olap_scan_node.cpp
+++ b/be/src/vec/exec/scan/new_olap_scan_node.cpp
@@ -383,14 +383,6 @@ Status 
NewOlapScanNode::_should_push_down_function_filter(VectorizedFnCall* fn_c
     return Status::OK();
 }
 
-bool NewOlapScanNode::_should_push_down_common_expr() {
-    return _state->enable_common_expr_pushdown() &&
-           (_olap_scan_node.keyType == TKeysType::DUP_KEYS ||
-            (_olap_scan_node.keyType == TKeysType::UNIQUE_KEYS &&
-             _olap_scan_node.__isset.enable_unique_key_merge_on_write &&
-             _olap_scan_node.enable_unique_key_merge_on_write));
-}
-
 // PlanFragmentExecutor will call this method to set scan range
 // Doris scan range is defined in thrift file like this
 // struct TPaloScanRange {
@@ -435,7 +427,7 @@ Status 
NewOlapScanNode::_init_scanners(std::list<VScannerSPtr>* scanners) {
                 message += conjunct->root()->debug_string();
             }
         }
-        _runtime_profile->add_info_string("RemainedDownPredicates", message);
+        _runtime_profile->add_info_string("RemainedPredicates", message);
     }
 
     if (!_olap_scan_node.output_column_unique_ids.empty()) {
diff --git a/be/src/vec/exec/scan/new_olap_scan_node.h 
b/be/src/vec/exec/scan/new_olap_scan_node.h
index 8cfa08131d..0725c37cf5 100644
--- a/be/src/vec/exec/scan/new_olap_scan_node.h
+++ b/be/src/vec/exec/scan/new_olap_scan_node.h
@@ -85,7 +85,16 @@ protected:
 
     PushDownType _should_push_down_is_null_predicate() override { return 
PushDownType::ACCEPTABLE; }
 
-    bool _should_push_down_common_expr() override;
+    bool _should_push_down_common_expr() override {
+        return _state->enable_common_expr_pushdown() && _storage_no_merge();
+    }
+
+    bool _storage_no_merge() override {
+        return (_olap_scan_node.keyType == TKeysType::DUP_KEYS ||
+                (_olap_scan_node.keyType == TKeysType::UNIQUE_KEYS &&
+                 _olap_scan_node.__isset.enable_unique_key_merge_on_write &&
+                 _olap_scan_node.enable_unique_key_merge_on_write));
+    }
 
     Status _init_scanners(std::list<VScannerSPtr>* scanners) override;
 
diff --git a/be/src/vec/exec/scan/vscan_node.cpp 
b/be/src/vec/exec/scan/vscan_node.cpp
index e65bdab093..07c68d1b17 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -549,7 +549,8 @@ Status VScanNode::_normalize_predicate(const VExprSPtr& 
conjunct_expr_root, VExp
                 return Status::OK();
             }
 
-            if (pdt == PushDownType::ACCEPTABLE && 
_is_key_column(slot->col_name())) {
+            if (pdt == PushDownType::ACCEPTABLE &&
+                (_is_key_column(slot->col_name()) || _storage_no_merge())) {
                 output_expr = nullptr;
                 return Status::OK();
             } else {
diff --git a/be/src/vec/exec/scan/vscan_node.h 
b/be/src/vec/exec/scan/vscan_node.h
index c023bbabe2..7600189a25 100644
--- a/be/src/vec/exec/scan/vscan_node.h
+++ b/be/src/vec/exec/scan/vscan_node.h
@@ -226,6 +226,8 @@ protected:
 
     virtual bool _should_push_down_common_expr() { return false; }
 
+    virtual bool _storage_no_merge() { return false; }
+
     virtual PushDownType _should_push_down_bloom_filter() { return 
PushDownType::UNACCEPTABLE; }
 
     virtual PushDownType _should_push_down_bitmap_filter() { return 
PushDownType::UNACCEPTABLE; }


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

Reply via email to