[fix](function) fix unexpected be core in string search function (#31312)

Fix be core in multi_match_any/multi_search_all_positions functions.
This commit is contained in:
xy720
2024-02-26 16:33:59 +08:00
committed by yiguolei
parent 35333d7a77
commit 3cee6c6722
6 changed files with 74 additions and 15 deletions

View File

@ -80,26 +80,22 @@ public:
Status execute_impl(FunctionContext* context, Block& block, const ColumnNumbers& arguments,
size_t result, size_t input_rows_count) const override {
auto haystack_column = block.get_by_position(arguments[0]).column;
auto haystack_ptr = haystack_column;
auto needles_column = block.get_by_position(arguments[1]).column;
auto needles_ptr = needles_column;
bool haystack_nullable = false;
bool needles_nullable = false;
if (haystack_column->is_nullable()) {
haystack_ptr = check_and_get_column<ColumnNullable>(haystack_column.get())
->get_nested_column_ptr();
haystack_nullable = true;
}
if (needles_column->is_nullable()) {
needles_ptr = check_and_get_column<ColumnNullable>(needles_column.get())
->get_nested_column_ptr();
needles_nullable = true;
}
auto haystack_ptr = remove_nullable(haystack_column);
auto needles_ptr = remove_nullable(needles_column);
const ColumnString* col_haystack_vector =
check_and_get_column<ColumnString>(&*haystack_ptr);
const ColumnConst* col_haystack_const =
@ -110,6 +106,11 @@ public:
const ColumnConst* col_needles_const =
check_and_get_column_const<ColumnArray>(needles_ptr.get());
if (!col_needles_const && !col_needles_vector)
return Status::InvalidArgument(
"function '{}' encountered unsupported needles column, found {}", name,
needles_column->get_name());
if (col_haystack_const && col_needles_vector) {
return Status::InvalidArgument(
"function '{}' doesn't support search with non-constant needles "