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


##########
r/src/altrep.cpp:
##########
@@ -892,7 +904,19 @@ struct AltrepVectorString : public 
AltrepVectorBase<AltrepVectorString<Type>> {
     return s;
   }
 
-  static void* Dataptr(SEXP alt, Rboolean writeable) { return 
DATAPTR(Materialize(alt)); }
+  static void* Dataptr(SEXP alt, Rboolean writeable) {
+    // DATAPTR(Materialize(alt)) is disallowed by CRAN, so we need to createt 
the array of
+    // string and place the SEXPs in it ourselves with STRING_ELT()
+    SEXP materialized = Materialize(alt);
+
+    R_xlen_t len = XLENGTH(materialized);
+    void** str_array = (void**)R_alloc(len, sizeof(void*));
+    for (R_xlen_t i = 0; i < len; i++) {
+      str_array[i] = (void*)STRING_ELT(materialized, i);
+    }
+
+    return str_array;

Review Comment:
   Yup! that works. Thanks 🙏 



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to