Skip to content

Commit

Permalink
const
Browse files Browse the repository at this point in the history
  • Loading branch information
nguyenv committed Jan 24, 2025
1 parent 800c9fa commit 9591f29
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
11 changes: 6 additions & 5 deletions libtiledbsoma/src/soma/column_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ class ColumnBuffer {
validity_.assign(num_elems, 1); // Default all to valid (1)
}
} else {
throw TileDBSOMAError(std::format(
"[ColumnBuffer] Validity buffer passed for non-nullable "
"column '{}'. Saw values: {}",
name_,
validity_values));
if (validity.has_value()) {
throw TileDBSOMAError(std::format(
"[ColumnBuffer] Validity buffer passed for non-nullable "
"column '{}'",
name_));
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions libtiledbsoma/src/soma/managed_query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1238,13 +1238,14 @@ std::vector<uint8_t> ManagedQuery::_cast_bool_data(
schema->format));
}

uint8_t* data = reinterpret_cast<uint8_t*>(array->buffers[1]);
const uint8_t* data = reinterpret_cast<const uint8_t*>(array->buffers[1]);
return *util::bitmap_to_uint8(data, array->length, array->offset);
}

std::optional<std::vector<uint8_t>> ManagedQuery::_cast_validity_buffer(
ArrowArray* array) {
uint8_t* validity = reinterpret_cast<uint8_t*>(array->buffers[0]);
const uint8_t* validity = reinterpret_cast<const uint8_t*>(
array->buffers[0]);
return util::bitmap_to_uint8(validity, array->length, array->offset);
}
}; // namespace tiledbsoma
2 changes: 1 addition & 1 deletion libtiledbsoma/src/utils/util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ std::string rstrip_uri(std::string_view uri) {
}

std::optional<std::vector<uint8_t>> bitmap_to_uint8(
uint8_t* bitmap, size_t length, size_t offset) {
const uint8_t* bitmap, size_t length, size_t offset) {
if (bitmap == nullptr) {
return std::nullopt;
}
Expand Down
2 changes: 1 addition & 1 deletion libtiledbsoma/src/utils/util.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ std::string rstrip_uri(std::string_view uri);
* @return std::optional<std::vector<uint8_t>>
*/
std::optional<std::vector<uint8_t>> bitmap_to_uint8(
uint8_t* bitmap, size_t length, size_t offset = 0);
const uint8_t* bitmap, size_t length, size_t offset = 0);

std::shared_ptr<SOMAColumn> find_column_by_name(
std::span<const std::shared_ptr<SOMAColumn>> columns,
Expand Down

0 comments on commit 9591f29

Please sign in to comment.