thisisnic commented on issue #48712:
URL: https://github.com/apache/arrow/issues/48712#issuecomment-3922978847

   I asked Claude to investigate this. Here's what it found:
   
   **Root cause:** When operations like `rename_with` need to determine the 
output schema, they create a zero-row placeholder table via 
`Table__from_schema()`. This placeholder table retains the original R metadata, 
including any `names` attribute. When converting to a data.frame, 
`apply_arrow_r_metadata()` at `r/R/metadata.R:211` tries to apply the stored 
`names` attribute (32 elements) to a length-0 placeholder vector, which fails 
because R requires `names` to match vector length.
   
   **Call chain:**
   ```
   rename_with.ArrowTabular
     → column_select
       → as.data.frame(implicit_schema(.data))
         → Table__from_schema(x)  # creates 0-row table
           → apply_arrow_r_metadata()
             → attributes(x)[...] <- r_metadata  # fails at line 211
   ```
   
   **Why two warnings:** `rename_with` internally calls both `select` and 
`rename`, each triggering the same path.


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