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

Function MakeAltrepVector

r/src/altrep.cpp:1044–1071  ·  view source on GitHub ↗

return an altrep R vector that shadows the array if possible

Source from the content-addressed store, hash-verified

1042
1043// return an altrep R vector that shadows the array if possible
1044SEXP MakeAltrepVector(const std::shared_ptr<ChunkedArray>& chunked_array) {
1045 // using altrep if
1046 // - the arrow.use_altrep is set to TRUE or unset (implicit TRUE)
1047 // - the chunked array has at least one element
1048 if (arrow::r::GetBoolOption("arrow.use_altrep", true) && chunked_array->length() > 0) {
1049 switch (chunked_array->type()->id()) {
1050 case arrow::Type::DOUBLE:
1051 return altrep::AltrepVectorPrimitive<REALSXP>::Make(chunked_array);
1052
1053 case arrow::Type::INT32:
1054 return altrep::AltrepVectorPrimitive<INTSXP>::Make(chunked_array);
1055
1056 case arrow::Type::STRING:
1057 return altrep::AltrepVectorString<StringType>::Make(chunked_array);
1058
1059 case arrow::Type::LARGE_STRING:
1060 return altrep::AltrepVectorString<LargeStringType>::Make(chunked_array);
1061
1062 case arrow::Type::DICTIONARY:
1063 return altrep::AltrepFactor::Make(chunked_array);
1064
1065 default:
1066 break;
1067 }
1068 }
1069
1070 return R_NilValue;
1071}
1072
1073bool is_arrow_altrep(SEXP x) {
1074 if (ALTREP(x)) {

Callers 2

ScheduleConvertTasksMethod · 0.85
MaybeAltrepMethod · 0.85

Calls 5

GetBoolOptionFunction · 0.85
MakeFunction · 0.50
lengthMethod · 0.45
idMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected