Skip to content

Commit

Permalink
[fix](bitmap) fix coredump of bitmap_from_array caused by null array …
Browse files Browse the repository at this point in the history
…literal
  • Loading branch information
jacktengg committed Sep 15, 2023
1 parent 00bb32c commit 140d57a
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions be/src/vec/functions/function_bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,9 @@ class FunctionBitmapAlwaysNull : public IFunction {
if (check_column<ColumnInt8>(nested_column)) {
Impl::template vector<ColumnInt8>(offset_column_data, nested_column,
nested_null_map, res, null_map);
} else if (check_column<ColumnUInt8>(nested_column)) {
Impl::template vector<ColumnUInt8>(offset_column_data, nested_column,
nested_null_map, res, null_map);
} else if (check_column<ColumnInt16>(nested_column)) {
Impl::template vector<ColumnInt16>(offset_column_data, nested_column,
nested_null_map, res, null_map);
Expand All @@ -391,6 +394,10 @@ class FunctionBitmapAlwaysNull : public IFunction {
} else if (check_column<ColumnInt64>(nested_column)) {
Impl::template vector<ColumnInt64>(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 {}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,9 @@ true
\N
\N

-- !sql --


-- !sql --


Original file line number Diff line number Diff line change
Expand Up @@ -1003,4 +1003,10 @@ suite("test_bitmap_function") {
qt_sql_bitmap_remove_not_null8 """ select bitmap_to_string(bitmap_remove(id, 4294967296)) s from test_bitmap_remove_not_null order by s; """
qt_sql_bitmap_remove_not_null9 """ select bitmap_to_string(bitmap_remove(id, null)) s from test_bitmap_remove_not_null order by s; """

// BITMAP_FROM_ARRAY
sql """ set experimental_enable_nereids_planner=false; """
qt_sql """ select bitmap_to_string(BITMAP_FROM_ARRAY([]));"""

sql """ set experimental_enable_nereids_planner=true; """
qt_sql """ select bitmap_to_string(BITMAP_FROM_ARRAY([]));"""
}

0 comments on commit 140d57a

Please sign in to comment.