Skip to content

Commit

Permalink
Fix Python tests, and straighten out logged method names
Browse files Browse the repository at this point in the history
  • Loading branch information
johnkerl committed Sep 27, 2024
1 parent 6631eb8 commit be66574
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions libtiledbsoma/src/utils/arrow_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -439,8 +439,8 @@ class ArrowAdapter {

if (std::is_same_v<T, std::string>) {
throw std::runtime_error(
"SOMAArray::_core_domain_slot: template-specialization "
"failure.");
"SOMAArray::get_table_non_string_column_by_index: "
"template-specialization failure.");
}

ArrowArray* child_array = _get_and_check_column(
Expand Down Expand Up @@ -542,7 +542,7 @@ class ArrowAdapter {
const ArrowArray* arrow_array, const ArrowSchema* arrow_schema) {
if (arrow_array->n_children != 0 || arrow_schema->n_children != 0) {
throw std::runtime_error(
"ArrowAdapter::get_array_non_string_column: expected leaf "
"ArrowAdapter::get_array_string_column: expected leaf "
"node");
}
if (arrow_array->n_buffers != 3) {
Expand All @@ -567,18 +567,19 @@ class ArrowAdapter {
}
if (arrow_array->buffers[1] == nullptr) {
throw std::runtime_error(
"ArrowAdapter::get_table_non_string_column_by_index: null "
"ArrowAdapter::get_array_string_column: null "
"offsets buffer");
}
if (arrow_array->buffers[2] == nullptr) {
throw std::runtime_error(
"ArrowAdapter::get_table_non_string_column_by_index: null data "
"ArrowAdapter::get_array_string_column: null data "
"buffer");
}

const char* data = (char*)arrow_array->buffers[2];

if (strcmp(arrow_schema->format, "u") == 0) {
if (strcmp(arrow_schema->format, "u") == 0 ||
strcmp(arrow_schema->format, "z") == 0) {
uint32_t* offsets = (uint32_t*)arrow_array->buffers[1];
int num_cells = (int)arrow_array->length;
std::vector<std::string> retval(num_cells);
Expand All @@ -588,7 +589,9 @@ class ArrowAdapter {
}
return retval;

} else if (strcmp(arrow_schema->format, "U") == 0) {
} else if (
strcmp(arrow_schema->format, "U") == 0 ||
strcmp(arrow_schema->format, "Z") == 0) {
uint64_t* offsets = (uint64_t*)arrow_array->buffers[1];
int num_cells = (int)arrow_array->length;
std::vector<std::string> retval(num_cells);
Expand All @@ -600,9 +603,8 @@ class ArrowAdapter {

} else {
throw std::runtime_error(
"ArrowAdapter::get_table_non_string_column_by_index: expected "
"Arrow "
"string or large_string");
"ArrowAdapter::get_array_string_column: expected "
"Arrow string, large_string, binary, or large_binary");
}
}

Expand Down

0 comments on commit be66574

Please sign in to comment.