This is an automated email from the ASF dual-hosted git repository.

thisisnic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/main by this push:
     new 66306aea2a GH-48712: [R] "Invalid metadata$r" warning (#49608)
66306aea2a is described below

commit 66306aea2a7931b9244335e42e47974440352c9f
Author: Nic Crane <[email protected]>
AuthorDate: Sat Apr 11 12:53:22 2026 +0100

    GH-48712: [R] "Invalid metadata$r" warning (#49608)
    
    ### Rationale for this change
    
    Warnings issued due to placeholder in the path when converting from schema 
-> Table -> data.frame
    
    ### What changes are included in this PR?
    
    Use `to_data_frame()` method which doesn't use placeholder.
    
    ### Are these changes tested?
    
    Yes
    
    ### Are there any user-facing changes?
    
    Yes - warning no longer issued
    * GitHub Issue: #48712
    
    Authored-by: Nic Crane <[email protected]>
    Signed-off-by: Nic Crane <[email protected]>
---
 r/R/schema.R                         |  2 +-
 r/tests/testthat/test-dplyr-select.R | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/r/R/schema.R b/r/R/schema.R
index 2c4ed14d7b..7a6e38c95e 100644
--- a/r/R/schema.R
+++ b/r/R/schema.R
@@ -467,7 +467,7 @@ as_schema.StructType <- function(x, ...) {
 
 #' @export
 as.data.frame.Schema <- function(x, row.names = NULL, optional = FALSE, ...) {
-  as.data.frame(Table__from_schema(x))
+  Table__from_schema(x)$to_data_frame()
 }
 
 #' @export
diff --git a/r/tests/testthat/test-dplyr-select.R 
b/r/tests/testthat/test-dplyr-select.R
index d3bfab637f..27826ad9e7 100644
--- a/r/tests/testthat/test-dplyr-select.R
+++ b/r/tests/testthat/test-dplyr-select.R
@@ -228,3 +228,16 @@ test_that("multiple select/rename and group_by", {
     tbl
   )
 })
+
+
+test_that("rename_with does not warn on columns with names metadata - 
GH48712", {
+  issue_tbl <- mutate(mtcars, cyl = setNames(cyl, nm = cyl))
+
+  out <- expect_no_warning(
+    arrow_table(issue_tbl) |>
+      rename_with(toupper) |>
+      collect()
+  )
+
+  expect_named(out, toupper(names(issue_tbl)))
+})

Reply via email to