Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
trueeyu committed Nov 24, 2023
1 parent 86490e3 commit 08065d3
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions be/src/exprs/bitmap_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -713,13 +713,14 @@ StatusOr<ColumnPtr> BitmapFunctions::bitmap_from_binary(FunctionContext* context

auto src_value = viewer.value(row);
if (src_value.size == 0) {
return Status::InternalError("Invalid binary format, the size of binary is 0");
builder.append_null();
continue;
}

BitmapValue bitmap;
bool res = bitmap.valid_and_deserialize(src_value.data, src_value.size);
if (!res) {
return Status::InternalError("Invalid binary format, unable to deserialize the binary to bitmap");
builder.append_null();
} else {
builder.append(std::move(bitmap));
}
Expand Down
4 changes: 2 additions & 2 deletions test/sql/test_bitmap_functions/R/test_bitmap_functions
Original file line number Diff line number Diff line change
Expand Up @@ -398,11 +398,11 @@ select c1, bitmap_to_string(bitmap_from_binary(bitmap_to_binary(c2))) from t1 or
-- !result
select bitmap_from_binary(to_binary("1234"));
-- result:
E: (1064, 'Invalid binary format, unable to deserialize the binary to bitmap')
None
-- !result
select bitmap_from_binary(to_binary(""));
-- result:
E: (1064, 'Invalid binary format, the size of binary is 0')
None
-- !result
select bitmap_from_binary(null);
-- result:
Expand Down

0 comments on commit 08065d3

Please sign in to comment.