Skip to content

Commit

Permalink
Fix bug in calculation of null bitmask buffer size
Browse files Browse the repository at this point in the history
This calculation needs to return the number of uint8 elements required to store a nullable bitmask
for a given number of records, which is "ceil(num_records, 8)" using the internal ceil function.

For #47 compatibility with arrow 0.15 release and current trunk, where additional consistency checks
have been added.
  • Loading branch information
ihnorton committed Jan 29, 2020
1 parent 58b17d1 commit aef2a17
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libtiledbvcf/src/c_api/arrow.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ class Arrow {
std::shared_ptr<arrow::Buffer> arrow_nulls;
if (buffer_info.nullable)
arrow_nulls = arrow::Buffer::Wrap(
buffer_info.bitmap_buff, ceil(num_data_elements, 8));
buffer_info.bitmap_buff, ceil(num_records, 8));

if (buffer_info.list) {
// List of var-len char attribute.
Expand Down Expand Up @@ -330,7 +330,7 @@ class Arrow {
std::shared_ptr<arrow::Buffer> arrow_nulls;
if (buffer_info.nullable)
arrow_nulls = arrow::Buffer::Wrap(
buffer_info.bitmap_buff, ceil(num_data_elements, 8));
buffer_info.bitmap_buff, ceil(num_records, 8));

std::shared_ptr<arrow::Array> values_array(
new ArrayT(num_data_elements, arrow_values));
Expand Down Expand Up @@ -395,4 +395,4 @@ class Arrow {
} // namespace vcf
} // namespace tiledb

#endif
#endif

0 comments on commit aef2a17

Please sign in to comment.