Skip to content

Commit

Permalink
Ensure DATETIME columns get Arrow coltype reset
Browse files Browse the repository at this point in the history
  • Loading branch information
eddelbuettel committed Mar 20, 2024
1 parent 3a88e6c commit 52a2f4a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions libtiledbsoma/src/utils/arrow_adapter.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,16 @@ ArrowAdapter::to_arrow(std::shared_ptr<ColumnBuffer> column) {
column->data_to_bitmap();

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

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L359

Added line #L359 was not covered by tests
}

// Workaround for datetime
if (column->type() == TILEDB_DATETIME_MS || column->type() == TILEDB_DATETIME_SEC) {
free((void*)schema->format); // free the 'storage' format
schema->format = strdup(to_arrow_format(column->type()).data());

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

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L364-L365

Added lines #L364 - L365 were not covered by tests
}

// Workaround for date
if (column->type() == TILEDB_DATETIME_DAY) {
free((void*)schema->format); // free the 'storage' format
schema->format = strdup(to_arrow_format(column->type()).data());

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

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L370-L371

Added lines #L370 - L371 were not covered by tests
// TODO: Put in ColumnBuffer
size_t n = array->length;
std::vector<int64_t> indata(n);
Expand All @@ -375,9 +383,8 @@ ArrowAdapter::to_arrow(std::shared_ptr<ColumnBuffer> column) {
}

if (column->has_enumeration()) {
auto dict_sch =
(ArrowSchema *)malloc(sizeof(ArrowSchema)); // new ArrowSchema;
auto dict_arr = (ArrowArray *)malloc(sizeof(ArrowArray)); // new ArrowArray;
auto dict_sch = (ArrowSchema *)malloc(sizeof(ArrowSchema));
auto dict_arr = (ArrowArray *)malloc(sizeof(ArrowArray));

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

View check run for this annotation

Codecov / codecov/patch

libtiledbsoma/src/utils/arrow_adapter.cc#L386-L387

Added lines #L386 - L387 were not covered by tests

auto enmr = column->get_enumeration_info();
auto dcoltype = to_arrow_format(enmr->type(), false).data();
Expand Down

0 comments on commit 52a2f4a

Please sign in to comment.