romainfrancois commented on a change in pull request #11369:
URL: https://github.com/apache/arrow/pull/11369#discussion_r725048745



##########
File path: r/src/altrep.cpp
##########
@@ -601,31 +616,41 @@ void Init_Altrep_classes(DllInfo* dll) {
 
 // return an altrep R vector that shadows the array if possible
 SEXP MakeAltrepVector(const std::shared_ptr<ChunkedArray>& chunked_array) {
+  // using altrep if
+  // - the arrow.use_altrep is set to TRUE or unset (implicit TRUE)
+  // - the chunked array has at least one element
+  if (!arrow::r::GetBoolOption("arrow.use_altrep", true) ||
+      chunked_array->length() == 0) {
+    return R_NilValue;
+  }
+
   // special case when there is only one array
   if (chunked_array->num_chunks() == 1) {

Review comment:
       This is temporary, these cases will move to the general switch below, 
once `altrep::AltrepVectorPrimitive` can deal with multiple chunks. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to