This is an automated email from the ASF dual-hosted git repository. kxiao pushed a commit to branch branch-2.0 in repository https://gitbox.apache.org/repos/asf/doris.git
commit 343d649a3bcadfbd8bc43309d79ae341b2f23e07 Author: amory <[email protected]> AuthorDate: Wed Oct 11 10:23:33 2023 +0800 [FIX](array_function) fix array_map function with array index function without checkout arg… #25226 --- be/src/vec/functions/array/function_array_index.h | 4 ++++ .../array_functions/test_array_map_function.groovy | 13 +++++++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/be/src/vec/functions/array/function_array_index.h b/be/src/vec/functions/array/function_array_index.h index 8e4d73687ab..f8d0a8b24df 100644 --- a/be/src/vec/functions/array/function_array_index.h +++ b/be/src/vec/functions/array/function_array_index.h @@ -294,6 +294,10 @@ private: // extract array offsets and nested data auto left_column = block.get_by_position(arguments[0]).column->convert_to_full_column_if_const(); + if (!is_array(remove_nullable(block.get_by_position(arguments[0]).type))) { + return Status::InvalidArgument(get_name() + " first argument must be array, but got " + + block.get_by_position(arguments[0]).type->get_name()); + } const ColumnArray* array_column = nullptr; const UInt8* array_null_map = nullptr; if (left_column->is_nullable()) { diff --git a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy index 9ab01a37f97..b699263c354 100644 --- a/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy +++ b/regression-test/suites/query_p0/sql_functions/array_functions/test_array_map_function.groovy @@ -70,7 +70,16 @@ suite("test_array_map_function") { qt_select_23 "select *,array_filter(x->x%2=0,c_array2) from array_test2 order by id;" qt_select_24 "select * from array_test2 order by array_max(array_map(x->x,c_array1));" - + + // array_map with countequal param should return error + test { + sql"""select c_array1,array_max(array_map(x->countequal(c_array1,x),c_array1)) from array_test2;""" + check{result, exception, startTime, endTime -> + assertTrue(exception != null) + logger.info(exception.message) + } + } + // Array not equal sql """INSERT INTO ${tableName} values (11, [6,7,8],[10,12,13]), @@ -79,7 +88,7 @@ suite("test_array_map_function") { """ test { - sql"""select /*+SET_VAR(experimental_enable_pipeline_engine=false)*/ array_map((x,y)->x+y, c_array1, c_array2) from array_test2 where id > 10 order by id;""" + sql"""select array_map((x,y)->x+y, c_array1, c_array2) from array_test2 where id > 10 order by id;""" check{result, exception, startTime, endTime -> assertTrue(exception != null) logger.info(exception.message) --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
