This is an automated email from the ASF dual-hosted git repository.
yiguolei pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 2e9875d5d72 [Bug](Func) Fix negative number in bitmap return error
result (#31571)
2e9875d5d72 is described below
commit 2e9875d5d72ec23f3e205e5b48f9adee733c2471
Author: HappenLee <[email protected]>
AuthorDate: Thu Feb 29 23:36:39 2024 +0800
[Bug](Func) Fix negative number in bitmap return error result (#31571)
---
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 305cf8a695f..f1d28f2d8b0 100644
--- a/be/src/vec/functions/function_bitmap.cpp
+++ b/be/src/vec/functions/function_bitmap.cpp
@@ -133,7 +133,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]