This is an automated email from the ASF dual-hosted git repository.
gabriellee 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 c3527672a5a [refactor & pipelineX][pick fix] Pick fix of predicate
pushdown to pipelineX (#25953)
c3527672a5a is described below
commit c3527672a5afd7b4a21f421e6fab0054931bfce5
Author: zhiqiang <[email protected]>
AuthorDate: Thu Oct 26 05:04:43 2023 -0500
[refactor & pipelineX][pick fix] Pick fix of predicate pushdown to
pipelineX (#25953)
Co-authored-by: JackDrogon <[email protected]>
---
be/src/pipeline/exec/scan_operator.cpp | 3 ++-
be/src/vec/exec/scan/vscan_node.cpp | 2 +-
be/src/vec/exprs/vexpr.cpp | 9 +++++++++
be/src/vec/exprs/vexpr.h | 16 +---------------
4 files changed, 13 insertions(+), 17 deletions(-)
diff --git a/be/src/pipeline/exec/scan_operator.cpp
b/be/src/pipeline/exec/scan_operator.cpp
index 38f7864db97..2df1755c811 100644
--- a/be/src/pipeline/exec/scan_operator.cpp
+++ b/be/src/pipeline/exec/scan_operator.cpp
@@ -249,7 +249,8 @@ Status ScanLocalState<Derived>::_normalize_conjuncts() {
RETURN_IF_ERROR(_normalize_predicate(conjunct->root(),
conjunct.get(), new_root));
if (new_root) {
conjunct->set_root(new_root);
- if (_should_push_down_common_expr()) {
+ if (_should_push_down_common_expr() &&
+
vectorized::VExpr::is_acting_on_a_slot(*(conjunct->root()))) {
_common_expr_ctxs_push_down.emplace_back(conjunct);
it = _conjuncts.erase(it);
continue;
diff --git a/be/src/vec/exec/scan/vscan_node.cpp
b/be/src/vec/exec/scan/vscan_node.cpp
index 602f5074eb1..b743de4b141 100644
--- a/be/src/vec/exec/scan/vscan_node.cpp
+++ b/be/src/vec/exec/scan/vscan_node.cpp
@@ -421,7 +421,7 @@ Status VScanNode::_normalize_conjuncts() {
if (new_root) {
conjunct->set_root(new_root);
if (_should_push_down_common_expr() &&
- VExpr::is_acting_on_a_slot(conjunct->root())) {
+ VExpr::is_acting_on_a_slot(*(conjunct->root()))) {
// We need to make sure conjunct is acting on a slot
before push it down.
// Or it will not be executed by
SegmentIterator::_vec_init_lazy_materialization
_common_expr_ctxs_push_down.emplace_back(conjunct);
diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp
index f8297a58651..bcd06cb6640 100644
--- a/be/src/vec/exprs/vexpr.cpp
+++ b/be/src/vec/exprs/vexpr.cpp
@@ -152,6 +152,15 @@ TExprNode create_texpr_node_from(const void* data, const
PrimitiveType& type, in
namespace doris::vectorized {
+bool VExpr::is_acting_on_a_slot(const VExpr& expr) {
+ const auto& children = expr.children();
+
+ auto is_a_slot = std::any_of(children.begin(), children.end(),
+ [](const auto& child) { return
is_acting_on_a_slot(*child); });
+
+ return is_a_slot ? true : (expr.node_type() == TExprNodeType::SLOT_REF);
+}
+
VExpr::VExpr(const TExprNode& node)
: _node_type(node.node_type),
_opcode(node.__isset.opcode ? node.opcode :
TExprOpcode::INVALID_OPCODE),
diff --git a/be/src/vec/exprs/vexpr.h b/be/src/vec/exprs/vexpr.h
index 3f7cb7ed593..e9f011a2c35 100644
--- a/be/src/vec/exprs/vexpr.h
+++ b/be/src/vec/exprs/vexpr.h
@@ -76,21 +76,7 @@ public:
return block->columns() - 1;
}
- static bool is_acting_on_a_slot(const VExprSPtr& expr) {
- const auto& children = expr->children();
- const size_t children_size = children.size();
-
- for (size_t i = 0; i < children_size; ++i) {
- // If any child expr acts on a column slot
- // return true immediately.
- if (is_acting_on_a_slot(children[i])) {
- return true;
- }
- }
-
- // This is a leaf expression.
- return expr->node_type() == TExprNodeType::SLOT_REF;
- }
+ static bool is_acting_on_a_slot(const VExpr& expr);
VExpr(const TExprNode& node);
VExpr(const VExpr& vexpr);
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]