gaborcsardi commented on code in PR #43351:
URL: https://github.com/apache/arrow/pull/43351#discussion_r1686647041


##########
r/src/arrow_cpp11.h:
##########
@@ -148,7 +148,7 @@ inline SEXP utf8_strings(SEXP x) {
 
     for (R_xlen_t i = 0; i < n; i++, ++p_x) {
       SEXP s = *p_x;
-      if (s != NA_STRING) {
+      if (s != NA_STRING && ALTREP(s)) {

Review Comment:
   I also think that `STRING_PTR_RO()` should materialize an ALTREP character 
vector, otherwise you can't iterate over the `CHARSXP` pointers. 
   
   Also, `ALTREP(s)` does not seem to make sense to me, that's a `CHARSXP` (not 
a `STRSXP`), so it cannot be ALTREP, unless I am misremembering something.
   
   Are you trying to catch the non-UTF-8 strings here? `Rf_translateCharUTF8()` 
does not do anything (returns the same `const char *`) if the string is UTF-8, 
so you could always call it, and only call `SET_STRING_ELT()` if the returned 
pointer is different?



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