HappenLee commented on code in PR #51618: URL: https://github.com/apache/doris/pull/51618#discussion_r2138055956
########## be/src/vec/exprs/lambda_function/varray_map_function.cpp: ########## @@ -186,6 +186,39 @@ class ArrayMapFunction : public LambdaFunction { data_types.push_back(col_type.get_nested_type()); } + ColumnWithTypeAndName result_arr; + // if column_array is NULL, we know the array_data_column will not write any data, + // so the column is empty. eg : (x) -> concat('|',x + "1"). if still execute the lambda function, will cause the bolck rows are not equal + // the x column is empty, but "|" is const literal, size of column is 1, so the block rows is 1, but the x column is empty, will be coredump. + if (std::any_of(lambda_datas.begin(), lambda_datas.end(), + [](const auto& v) { return v->empty(); })) { + DataTypePtr nested_type; + bool is_nullable = result_type->is_nullable(); + if (is_nullable) { + nested_type = + assert_cast<const DataTypeNullable*>(result_type.get())->get_nested_type(); + } else { + nested_type = result_type; + } + auto empty_nested_column = assert_cast<const DataTypeArray*>(nested_type.get()) + ->get_nested_type() + ->create_column(); + auto result_array_column = ColumnArray::create(std::move(empty_nested_column), + std::move(array_column_offset)); + + if (is_nullable) { + result_arr = {ColumnNullable::create(std::move(result_array_column), + std::move(outside_null_map)), + result_type, "Result"}; + } else { + result_arr = {std::move(result_array_column), result_type, "Result"}; Review Comment: should add a case test the code line -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org