From 33d1c6e646aa0eed5daae33fc348de404a768f40 Mon Sep 17 00:00:00 2001 From: jacktengg <18241664+jacktengg@users.noreply.github.com> Date: Fri, 15 Sep 2023 11:39:53 +0800 Subject: [PATCH] [fix](bitmap) fix coredump of bitmap_from_array caused by null array literal --- be/src/vec/functions/function_bitmap.cpp | 7 +++++++ .../bitmap_functions/test_bitmap_function.out | 3 +++ .../bitmap_functions/test_bitmap_function.groovy | 3 +++ 3 files changed, 13 insertions(+) diff --git a/be/src/vec/functions/function_bitmap.cpp b/be/src/vec/functions/function_bitmap.cpp index 9296fb9c105fba..f1570628e65519 100644 --- a/be/src/vec/functions/function_bitmap.cpp +++ b/be/src/vec/functions/function_bitmap.cpp @@ -292,6 +292,9 @@ class FunctionBitmapAlwaysNull : public IFunction { if (check_column(nested_column)) { Impl::template vector(offset_column_data, nested_column, nested_null_map, res, null_map); + } else if (check_column(nested_column)) { + Impl::template vector(offset_column_data, nested_column, + nested_null_map, res, null_map); } else if (check_column(nested_column)) { Impl::template vector(offset_column_data, nested_column, nested_null_map, res, null_map); @@ -301,6 +304,10 @@ class FunctionBitmapAlwaysNull : public IFunction { } else if (check_column(nested_column)) { Impl::template vector(offset_column_data, nested_column, nested_null_map, res, null_map); + } else { + return Status::RuntimeError("Illegal column {} of argument of function {}", + block.get_by_position(arguments[0]).column->get_name(), + get_name()); } } else { return Status::RuntimeError("Illegal column {} of argument of function {}", diff --git a/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_function.out b/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_function.out index acfc638330d991..501c15350c3a6b 100644 --- a/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_function.out +++ b/regression-test/data/query_p0/sql_functions/bitmap_functions/test_bitmap_function.out @@ -510,3 +510,6 @@ true -- !sql_orthogonal_bitmap_intersect_count -- 1 1 +-- !sql -- + + diff --git a/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy b/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy index 92c1e435eb0f09..2f01f183e7b6da 100644 --- a/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy +++ b/regression-test/suites/query_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy @@ -762,4 +762,7 @@ suite("test_bitmap_function") { select count(distinct tag) as count1, orthogonal_bitmap_intersect_count(id_bitmap, tag, 0) as count2_bitmap from test_orthog_bitmap_intersect; """ + + // BITMAP_FROM_ARRAY + qt_sql """ select bitmap_to_string(BITMAP_FROM_ARRAY([]));""" }