diff --git a/be/src/vec/functions/function_bitmap.cpp b/be/src/vec/functions/function_bitmap.cpp index 6886d53004..d1f6cf432e 100644 --- a/be/src/vec/functions/function_bitmap.cpp +++ b/be/src/vec/functions/function_bitmap.cpp @@ -132,7 +132,9 @@ struct ToBitmap { continue; } } - res_data[i].add(col->get_data()[i]); + if (auto value = col->get_data()[i]; value >= 0) { + res_data[i].add(value); + } } } } diff --git a/regression-test/data/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.out b/regression-test/data/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.out index d344ad27bf..ead150506e 100644 --- a/regression-test/data/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.out +++ b/regression-test/data/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.out @@ -406,7 +406,7 @@ true 1 -- !sql -- - +0 -- !sql -- \N 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 8afca0f983..1c3ae41446 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 @@ -415,7 +415,7 @@ true 1 -- !sql -- - +0 -- !sql -- \N diff --git a/regression-test/suites/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy b/regression-test/suites/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy index f3d9515875..8e2f3fa0d8 100644 --- a/regression-test/suites/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy +++ b/regression-test/suites/nereids_p0/sql_functions/bitmap_functions/test_bitmap_function.groovy @@ -571,7 +571,7 @@ suite("test_bitmap_function") { // TO_BITMAP qt_sql """ select bitmap_count(to_bitmap(10)) """ - qt_sql """ select bitmap_to_string(to_bitmap("-1")) """ + qt_sql """ select bitmap_count(to_bitmap("-1")) """ // BITMAP_MAX qt_sql """ select bitmap_max(bitmap_from_string('')) value; """ 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 36e36d6762..e7e564ce90 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 @@ -579,7 +579,7 @@ suite("test_bitmap_function") { // TO_BITMAP qt_sql """ select bitmap_count(to_bitmap(10)) """ - qt_sql """ select bitmap_to_string(to_bitmap("-1")) """ + qt_sql """ select bitmap_count(to_bitmap("-1")) """ // BITMAP_MAX qt_sql """ select bitmap_max(bitmap_from_string('')) value; """