Skip to content

Commit

Permalink
Replace two memcpy() calls with Arrow{Array,Schema}Move (#667)
Browse files Browse the repository at this point in the history
There is no change in behavior as a glance at nanoarrow.h shows but it is a
better idiom
  • Loading branch information
eddelbuettel authored Mar 14, 2024
1 parent 3266ad4 commit 546059b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/arrowio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,9 @@ nanoarrowXPtr libtiledb_to_arrow(Rcpp::XPtr<tiledb::ArrayBuffers> ab,

spdl::info(tfm::format("[libtiledb_to_arrow] Incoming name %s length %d",
std::string(pp.second->name), pp.first->length));
memcpy((void*) sch->children[i], pp.second.get(), sizeof(ArrowSchema));
memcpy((void*) arr->children[i], pp.first.get(), sizeof(ArrowArray));
ArrowArrayMove(pp.first.get(), arr->children[i]);
ArrowSchemaMove(pp.second.get(), sch->children[i]);

if (is_factor) { // create an arrow array of type string with the labels
// this could be rewritten if we generalized ColumnBuffer to allow passing of strings
std::vector<std::string> svec = Rcpp::as<std::vector<std::string>>(dicts[i]);
Expand Down

0 comments on commit 546059b

Please sign in to comment.