jonkeane commented on code in PR #48634:
URL: https://github.com/apache/arrow/pull/48634#discussion_r2643274341


##########
r/src/altrep.cpp:
##########
@@ -574,11 +575,10 @@ struct AltrepFactor : public 
AltrepVectorBase<AltrepFactor> {
     // the representation integer vector
     SEXP dup = PROTECT(Rf_shallow_duplicate(Materialize(alt)));
 
-    // additional attributes from the altrep
-    SEXP atts = PROTECT(Rf_duplicate(ATTRIB(alt)));
-    SET_ATTRIB(dup, atts);
+    // copy attributes from the altrep object
+    DUPLICATE_ATTRIB(dup, alt);
 
-    UNPROTECT(2);
+    UNPROTECT(1);

Review Comment:
   I don't know altrep well enough to know the answer, but copying the whole 
object sounds like it might be detrimental to performance — any idea if that's 
true? 



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