MCPcopy Create free account
hub / github.com/apache/arrow / Materialize

Method Materialize

r/src/altrep.cpp:521–540  ·  view source on GitHub ↗

TODO: this is similar to the primitive Materialize

Source from the content-addressed store, hash-verified

519
520 // TODO: this is similar to the primitive Materialize
521 static SEXP Materialize(SEXP alt) {
522 if (!IsMaterialized(alt)) {
523 auto size = Base::Length(alt);
524
525 // create a standard R vector
526 SEXP copy = PROTECT(Rf_allocVector(INTSXP, size));
527
528 // copy the data from the array, through Get_region
529 Get_region(alt, 0, size, INTEGER(copy));
530
531 // store as data2, this is now considered materialized
532 SetRepresentation(alt, copy);
533
534 // remove the ChunkedArray reference
535 R_set_altrep_data1(alt, R_NilValue);
536
537 UNPROTECT(1);
538 }
539 return Representation(alt);
540 }
541
542 static const void* Dataptr_or_null(SEXP alt) {
543 if (IsMaterialized(alt)) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected