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



##########
File path: r/src/altrep.cpp
##########
@@ -215,9 +219,10 @@ struct AltrepVectorPrimitive : public 
AltrepVectorBase<AltrepVectorPrimitive<sex
 
   // The value at position i
   static c_type Elt(SEXP alt, R_xlen_t i) {
-    const auto& array = GetArray(alt);
-    return array->IsNull(i) ? cpp11::na<c_type>()
-                            : array->data()->template GetValues<c_type>(1)[i];
+    auto array = GetChunkedArray(alt)->Slice(i, 1)->chunk(0);

Review comment:
       Slicing is quite expensive for this. You should instead resolve the 
chunk yourself.
   




-- 
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