Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions be/src/vec/exec/scan/vscan_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@
#include "vec/runtime/vdatetime_value.h"

namespace doris::vectorized {
namespace {
bool 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);
}
} // namespace

#define RETURN_IF_PUSH_DOWN(stmt, status) \
if (pdt == PushDownType::UNACCEPTABLE) { \
Expand Down Expand Up @@ -420,8 +429,7 @@ Status VScanNode::_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() &&
VExpr::is_acting_on_a_slot(conjunct->root())) {
if (_should_push_down_common_expr() && 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);
Expand Down
16 changes: 0 additions & 16 deletions be/src/vec/exprs/vexpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,22 +76,6 @@ class VExpr {
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;
}

VExpr(const TExprNode& node);
VExpr(const VExpr& vexpr);
VExpr(const TypeDescriptor& type, bool is_slotref, bool is_nullable);
Expand Down