This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0 by this push:
new 66d5708cd49 [fix](expr)Remove the _can_fast_execute flag from VExpr.
(#45542) (#45655)
66d5708cd49 is described below
commit 66d5708cd49433b102be04126cf9aa7583f0baaa
Author: Mryange <[email protected]>
AuthorDate: Sun Dec 22 21:28:08 2024 +0800
[fix](expr)Remove the _can_fast_execute flag from VExpr. (#45542) (#45655)
---
be/src/vec/exprs/vcompound_pred.h | 4 +---
be/src/vec/exprs/vectorized_fn_call.cpp | 2 +-
be/src/vec/exprs/vexpr.cpp | 2 --
be/src/vec/exprs/vexpr.h | 1 -
be/src/vec/exprs/vin_predicate.cpp | 24 ++++++++++--------------
be/src/vec/exprs/vin_predicate.h | 2 --
be/src/vec/exprs/vmatch_predicate.cpp | 2 +-
7 files changed, 13 insertions(+), 24 deletions(-)
diff --git a/be/src/vec/exprs/vcompound_pred.h
b/be/src/vec/exprs/vcompound_pred.h
index faed6788ba3..9e39533a7ae 100644
--- a/be/src/vec/exprs/vcompound_pred.h
+++ b/be/src/vec/exprs/vcompound_pred.h
@@ -144,15 +144,13 @@ public:
}
if (all_pass && !res.is_empty()) {
- // set fast_execute when expr evaluated by inverted index correctly
- _can_fast_execute = true;
context->get_inverted_index_context()->set_inverted_index_result_for_expr(this,
res);
}
return Status::OK();
}
Status execute(VExprContext* context, Block* block, int* result_column_id)
override {
- if (_can_fast_execute && fast_execute(context, block,
result_column_id)) {
+ if (fast_execute(context, block, result_column_id)) {
return Status::OK();
}
if (children().size() == 1 || !_all_child_is_compound_and_not_const())
{
diff --git a/be/src/vec/exprs/vectorized_fn_call.cpp
b/be/src/vec/exprs/vectorized_fn_call.cpp
index 427059bba41..7e4e4411f6f 100644
--- a/be/src/vec/exprs/vectorized_fn_call.cpp
+++ b/be/src/vec/exprs/vectorized_fn_call.cpp
@@ -152,7 +152,7 @@ Status
VectorizedFnCall::_do_execute(doris::vectorized::VExprContext* context,
if (is_const_and_have_executed()) { // const have executed in open function
return get_result_from_const(block, _expr_name, result_column_id);
}
- if (_can_fast_execute && fast_execute(context, block, result_column_id)) {
+ if (fast_execute(context, block, result_column_id)) {
return Status::OK();
}
DBUG_EXECUTE_IF("VectorizedFnCall.must_in_slow_path", {
diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp
index 7e77d92c310..ca30b504446 100644
--- a/be/src/vec/exprs/vexpr.cpp
+++ b/be/src/vec/exprs/vexpr.cpp
@@ -731,8 +731,6 @@ Status VExpr::_evaluate_inverted_index(VExprContext*
context, const FunctionBase
for (int column_id : column_ids) {
index_context->set_true_for_inverted_index_status(this, column_id);
}
- // set fast_execute when expr evaluated by inverted index correctly
- _can_fast_execute = true;
}
return Status::OK();
}
diff --git a/be/src/vec/exprs/vexpr.h b/be/src/vec/exprs/vexpr.h
index 142ab6a27d2..adf81124814 100644
--- a/be/src/vec/exprs/vexpr.h
+++ b/be/src/vec/exprs/vexpr.h
@@ -320,7 +320,6 @@ protected:
// ensuring uniqueness during index traversal
uint32_t _index_unique_id = 0;
- bool _can_fast_execute = false;
};
} // namespace vectorized
diff --git a/be/src/vec/exprs/vin_predicate.cpp
b/be/src/vec/exprs/vin_predicate.cpp
index 179a30971ea..7ea585b95c5 100644
--- a/be/src/vec/exprs/vin_predicate.cpp
+++ b/be/src/vec/exprs/vin_predicate.cpp
@@ -102,17 +102,6 @@ Status VInPredicate::open(RuntimeState* state,
VExprContext* context,
return Status::OK();
}
-size_t VInPredicate::skip_constant_args_size() const {
- if (_is_args_all_constant && !_can_fast_execute) {
- // This is an optimization. For expressions like colA IN (1, 2, 3, 4),
- // where all values inside the IN clause are constants,
- // a hash set is created during open, and it will not be accessed
again during execute
- // Here, _children[0] is colA
- return 1;
- }
- return _children.size();
-}
-
void VInPredicate::close(VExprContext* context,
FunctionContext::FunctionStateScope scope) {
VExpr::close_function_context(context, scope, _function);
VExpr::close(context, scope);
@@ -127,12 +116,19 @@ Status VInPredicate::execute(VExprContext* context,
Block* block, int* result_co
if (is_const_and_have_executed()) { // const have execute in open function
return get_result_from_const(block, _expr_name, result_column_id);
}
- if (_can_fast_execute && fast_execute(context, block, result_column_id)) {
+ if (fast_execute(context, block, result_column_id)) {
return Status::OK();
}
DCHECK(_open_finished || _getting_const_col);
- doris::vectorized::ColumnNumbers arguments(skip_constant_args_size());
- for (int i = 0; i < skip_constant_args_size(); ++i) {
+
+ // This is an optimization. For expressions like colA IN (1, 2, 3, 4),
+ // where all values inside the IN clause are constants,
+ // a hash set is created during open, and it will not be accessed again
during execute
+ // Here, _children[0] is colA
+ const size_t args_size = _is_args_all_constant ? 1 : _children.size();
+
+ doris::vectorized::ColumnNumbers arguments(args_size);
+ for (int i = 0; i < args_size; ++i) {
int column_id = -1;
RETURN_IF_ERROR(_children[i]->execute(context, block, &column_id));
arguments[i] = column_id;
diff --git a/be/src/vec/exprs/vin_predicate.h b/be/src/vec/exprs/vin_predicate.h
index 1b640056284..3d3846427d6 100644
--- a/be/src/vec/exprs/vin_predicate.h
+++ b/be/src/vec/exprs/vin_predicate.h
@@ -51,8 +51,6 @@ public:
std::string debug_string() const override;
- size_t skip_constant_args_size() const;
-
const FunctionBasePtr function() { return _function; }
bool is_not_in() const { return _is_not_in; };
diff --git a/be/src/vec/exprs/vmatch_predicate.cpp
b/be/src/vec/exprs/vmatch_predicate.cpp
index c80933df13c..9311cfc360f 100644
--- a/be/src/vec/exprs/vmatch_predicate.cpp
+++ b/be/src/vec/exprs/vmatch_predicate.cpp
@@ -132,7 +132,7 @@ Status
VMatchPredicate::evaluate_inverted_index(VExprContext* context, uint32_t
Status VMatchPredicate::execute(VExprContext* context, Block* block, int*
result_column_id) {
DCHECK(_open_finished || _getting_const_col);
- if (_can_fast_execute && fast_execute(context, block, result_column_id)) {
+ if (fast_execute(context, block, result_column_id)) {
return Status::OK();
}
DBUG_EXECUTE_IF("VMatchPredicate.execute", {
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]