From eb0e948577ea7aaf24b8a9b9b67f9287cb78dc96 Mon Sep 17 00:00:00 2001 From: BiteTheDDDDt Date: Fri, 25 Aug 2023 12:50:30 +0800 Subject: [PATCH] Remove redundant predicates on scan node --- 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 d6a72d49a1dc36..13b8e92119a503 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* 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 8cfa08131df73a..0725c37cf5e735 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 @@ class NewOlapScanNode : public VScanNode { 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* scanners) override; diff --git a/be/src/vec/exec/scan/vscan_node.cpp b/be/src/vec/exec/scan/vscan_node.cpp index e65bdab09302e5..07c68d1b17962f 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 c023bbabe2a176..7600189a251126 100644 --- a/be/src/vec/exec/scan/vscan_node.h +++ b/be/src/vec/exec/scan/vscan_node.h @@ -226,6 +226,8 @@ class VScanNode : public ExecNode, public RuntimeFilterConsumer { 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; }