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

airborne 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 2530049d169 [fix](inverted index) fix error handling in fast_execute 
(#40024) (#43393)
2530049d169 is described below

commit 2530049d16940252c931706db7e5c0207da2439a
Author: zzzxl <33418555+zzzxl1...@users.noreply.github.com>
AuthorDate: Fri Nov 8 09:52:28 2024 +0800

    [fix](inverted index) fix error handling in fast_execute (#40024) (#43393)
    
    pick https://github.com/apache/doris/pull/40024
    
    Co-authored-by: zzzxl1993 <yangs...@selectdb.com>
---
 be/src/vec/exprs/vexpr.cpp | 13 +++++++++++++
 be/src/vec/exprs/vexpr.h   |  2 ++
 2 files changed, 15 insertions(+)

diff --git a/be/src/vec/exprs/vexpr.cpp b/be/src/vec/exprs/vexpr.cpp
index e37dfc54651..74a90f49a57 100644
--- a/be/src/vec/exprs/vexpr.cpp
+++ b/be/src/vec/exprs/vexpr.cpp
@@ -107,6 +107,7 @@ Status VExpr::prepare(RuntimeState* state, const 
RowDescriptor& row_desc, VExprC
         RETURN_IF_ERROR(_children[i]->prepare(state, row_desc, context));
     }
     --context->_depth_num;
+    _enable_inverted_index_query = 
state->query_options().enable_inverted_index_query;
     return Status::OK();
 }
 
@@ -451,6 +452,10 @@ Status VExpr::check_constant(const Block& block, 
ColumnNumbers arguments) const
 
 bool VExpr::fast_execute(Block& block, const ColumnNumbers& arguments, size_t 
result,
                          size_t input_rows_count, const std::string& 
function_name) {
+    if (!_enable_inverted_index_query) {
+        return false;
+    }
+
     std::string result_column_name = gen_predicate_result_sign(block, 
arguments, function_name);
     if (!block.has(result_column_name)) {
         return false;
@@ -481,11 +486,19 @@ std::string VExpr::gen_predicate_result_sign(Block& 
block, const ColumnNumbers&
         std::set<std::string> values;
         for (size_t i = 1; i < arguments.size(); i++) {
             const auto& entry = block.get_by_position(arguments[i]);
+            if (!is_column_const(*entry.column)) {
+                return pred_result_sign;
+            }
             values.insert(entry.type->to_string(*entry.column, 0));
         }
         pred_result_sign += boost::join(values, ",");
+    } else if (function_name == "collection_in" || function_name == 
"collection_not_in") {
+        return pred_result_sign;
     } else {
         const auto& entry = block.get_by_position(arguments[1]);
+        if (!is_column_const(*entry.column)) {
+            return pred_result_sign;
+        }
         pred_result_sign += entry.type->to_string(*entry.column, 0);
     }
     return pred_result_sign;
diff --git a/be/src/vec/exprs/vexpr.h b/be/src/vec/exprs/vexpr.h
index 8b98f377de7..0416cbf69ff 100644
--- a/be/src/vec/exprs/vexpr.h
+++ b/be/src/vec/exprs/vexpr.h
@@ -277,6 +277,8 @@ protected:
     // get_const_col()
     std::shared_ptr<ColumnPtrWrapper> _constant_col;
     bool _prepared;
+
+    bool _enable_inverted_index_query = true;
 };
 
 } // namespace vectorized


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to