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 14, 2023
1 parent 5ba1f62 commit c315f1f
Show file tree
Hide file tree
Showing 3 changed files with 13 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 @@ -35,6 +35,9 @@ true
-- !sql --
\N

-- !sql --


-- !sql --
false

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ suite("test_bitmap_function") {
qt_sql """ select bitmap_to_string(bitmap_from_string("0, 1, 2")) """
qt_sql """ select bitmap_from_string("-1, 0, 1, 2") """

// BITMAP_FROM_ARRAY
qt_sql """ select bitmap_to_string(BITMAP_FROM_ARRAY([]));"""

// BITMAP_HAS_ANY
qt_sql """ select bitmap_has_any(to_bitmap(1),to_bitmap(2)) cnt """
qt_sql """ select bitmap_has_any(to_bitmap(1),to_bitmap(1)) cnt """
Expand Down

0 comments on commit c315f1f

Please sign in to comment.