Skip to content

Commit

Permalink
[fix](inverted index) fix error handling in fast_execute (#40024) (#4…
Browse files Browse the repository at this point in the history
…3393)

pick #40024

Co-authored-by: zzzxl1993 <[email protected]>
  • Loading branch information
zzzxl1993 and zzzxl1993 authored Nov 8, 2024
1 parent e6b5108 commit 2530049
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
13 changes: 13 additions & 0 deletions be/src/vec/exprs/vexpr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions be/src/vec/exprs/vexpr.h
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@ class VExpr {
// get_const_col()
std::shared_ptr<ColumnPtrWrapper> _constant_col;
bool _prepared;

bool _enable_inverted_index_query = true;
};

} // namespace vectorized
Expand Down

0 comments on commit 2530049

Please sign in to comment.