From 1e06763366c59111d316e2d1ca83a00e1dacd76b Mon Sep 17 00:00:00 2001 From: luozenglin Date: Mon, 17 Apr 2023 13:23:27 +0800 Subject: [PATCH] [fix](bitmap) fix bitmap_count errors to set nullable to non-nullable bitmap col (#18689) --- be/src/vec/functions/function_bitmap.cpp | 2 +- be/src/vec/functions/function_bitmap_min_or_max.h | 2 +- .../data/query_p0/join/test_bitmap_filter.out | 9 +++++++++ .../suites/query_p0/join/test_bitmap_filter.groovy | 2 ++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/be/src/vec/functions/function_bitmap.cpp b/be/src/vec/functions/function_bitmap.cpp index d6cf1652db..7d340f6937 100644 --- a/be/src/vec/functions/function_bitmap.cpp +++ b/be/src/vec/functions/function_bitmap.cpp @@ -412,7 +412,7 @@ public: auto data_null_map = ColumnUInt8::create(input_rows_count, 0); auto& null_map = data_null_map->get_data(); - auto& column = block.get_by_position(arguments[0]).column; + auto column = block.get_by_position(arguments[0]).column; if (auto* nullable = check_and_get_column(*column)) { VectorizedUtils::update_null_map(null_map, nullable->get_null_map_data()); column = nullable->get_nested_column_ptr(); diff --git a/be/src/vec/functions/function_bitmap_min_or_max.h b/be/src/vec/functions/function_bitmap_min_or_max.h index 788f8222a5..4f7018292d 100644 --- a/be/src/vec/functions/function_bitmap_min_or_max.h +++ b/be/src/vec/functions/function_bitmap_min_or_max.h @@ -56,7 +56,7 @@ public: auto result_column = ColumnInt64::create(); auto result_null_map_column = ColumnUInt8::create(input_rows_count, 0); - ColumnPtr& argument_column = block.get_by_position(arguments[0]).column; + ColumnPtr argument_column = block.get_by_position(arguments[0]).column; if (auto* nullable = check_and_get_column(*argument_column)) { // Danger: Here must dispose the null map data first! Because // argument_columns[i]=nullable->get_nested_column_ptr(); will release the mem diff --git a/regression-test/data/query_p0/join/test_bitmap_filter.out b/regression-test/data/query_p0/join/test_bitmap_filter.out index 1ad7849124..925421cbe2 100644 --- a/regression-test/data/query_p0/join/test_bitmap_filter.out +++ b/regression-test/data/query_p0/join/test_bitmap_filter.out @@ -138,3 +138,12 @@ 14 255 15 1992 +-- !sql19 -- +1 +3 +5 +7 +9 +11 +13 + diff --git a/regression-test/suites/query_p0/join/test_bitmap_filter.groovy b/regression-test/suites/query_p0/join/test_bitmap_filter.groovy index fe18451978..d6286e91bd 100644 --- a/regression-test/suites/query_p0/join/test_bitmap_filter.groovy +++ b/regression-test/suites/query_p0/join/test_bitmap_filter.groovy @@ -77,6 +77,8 @@ suite("test_bitmap_filter", "query_p0") { qt_sql18 "select k1, k2 from ${tbl1} t where 100 not in (select k2 from ${tbl2}) order by 1, 2;" + qt_sql19 "select k1 from ${tbl1} t where k1 in (select k2 from ${tbl2} where bitmap_count(k2) > 6) order by 1;" + test { sql "select k1, k2 from ${tbl1} b1 where k1 in (select k2 from ${tbl2} b2 where b1.k2 = b2.k1) order by k1;" exception "In bitmap does not support correlated subquery"