Skip to content

Commit

Permalink
Post-rebase change
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Mar 27, 2024
1 parent 06780b6 commit bed7757
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions libtiledbsoma/src/utils/arrow_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,13 @@ std::unique_ptr<ArrowSchema> ArrowAdapter::arrow_schema_from_tiledb_array(
auto dict = (ArrowSchema *)malloc(sizeof(ArrowSchema));
dict->format =
strdup(ArrowAdapter::to_arrow_format(enmr.type(), false).data());

Check warning on line 193 in libtiledbsoma/src/utils/arrow_adapter.cc

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L189-L193

Added lines #L189 - L193 were not covered by tests
if (enmr.type() == TILEDB_STRING_ASCII or
enmr.type() == TILEDB_CHAR) {
dict->format = strdup("z");
} else {
dict->format = strdup(
ArrowAdapter::to_arrow_format(enmr.type(), false).data());

Check warning on line 199 in libtiledbsoma/src/utils/arrow_adapter.cc

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L195-L199

Added lines #L195 - L199 were not covered by tests
}
dict->name = strdup(enmr.name().c_str());
dict->metadata = nullptr;
dict->flags = 0;
Expand Down Expand Up @@ -409,7 +416,7 @@ ArrowAdapter::to_arrow(std::shared_ptr<ColumnBuffer> column) {
exitIfError(ArrowArrayInitFromType(dict_arr, dnatype), "Bad array init");
exitIfError(ArrowArrayAllocateChildren(dict_arr, 0),
"Bad array children alloc");
const int n_buf = strcmp(dict_sch->format, "u") == 0 ? 3 : 2;
const int n_buf = ArrowAdapter::_isstr(dict_sch->format) == 0 ? 3 : 2;
dict_arr->buffers = (const void **)malloc(sizeof(void *) * n_buf);
dict_arr->buffers[0] = nullptr; // validity: none here
dict_arr->release = &release_array;

Check warning on line 422 in libtiledbsoma/src/utils/arrow_adapter.cc

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L416-L422

Added lines #L416 - L422 were not covered by tests
Expand All @@ -424,7 +431,8 @@ ArrowAdapter::to_arrow(std::shared_ptr<ColumnBuffer> column) {
// returns std::optional where std::nullopt indicates the
// column does not contain enumerated values.
if (enmr->type() == TILEDB_STRING_ASCII or
enmr->type() == TILEDB_STRING_UTF8) {
enmr->type() == TILEDB_STRING_UTF8 or
enmr->type() == TILEDB_CHAR) {
auto dict_vec = enmr->as_vector<std::string>();
column->convert_enumeration();
dict_arr->buffers[1] = column->enum_offsets().data();
Expand Down

0 comments on commit bed7757

Please sign in to comment.