This is an automated email from the ASF dual-hosted git repository. yiguolei pushed a commit to branch branch-2.1 in repository https://gitbox.apache.org/repos/asf/doris.git
commit ff3c7765d633695b7757816a160650324e340361 Author: HappenLee <[email protected]> AuthorDate: Thu Feb 29 11:08:03 2024 +0800 [Bug](Func) Fix negative number in bitmap return error result (#31563) --- be/src/vec/functions/function_bitmap.cpp | 4 +++- .../sql_functions/bitmap_functions/test_bitmap_function.out | 2 +- .../query_p0/sql_functions/bitmap_functions/test_bitmap_function.out | 2 +- .../sql_functions/bitmap_functions/test_bitmap_function.groovy | 2 +- .../sql_functions/bitmap_functions/test_bitmap_function.groovy | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/be/src/vec/functions/function_bitmap.cpp b/be/src/vec/functions/function_bitmap.cpp index 6886d53004b..d1f6cf432ee 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 d344ad27bff..ead150506e8 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 8afca0f9838..1c3ae414464 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 f3d95158755..8e2f3fa0d8d 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 36e36d67624..e7e564ce906 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; """ --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
