jonkeane commented on code in PR #50178:
URL: https://github.com/apache/arrow/pull/50178#discussion_r3424941870
##########
r/R/arrow-tabular.R:
##########
@@ -82,10 +82,10 @@ ArrowTabular <- R6Class(
# Helper for the R metadata that handles the serialization
# See also method on Schema
if (missing(new)) {
- self$metadata$r
+ self$metadata[["r"]]
} else {
# Set the R metadata
- self$metadata$r <- new
+ self$metadata[["r"]] <- new
Review Comment:
I love partial matching so much.
##########
r/tests/testthat/test-metadata.R:
##########
@@ -517,3 +517,11 @@ test_that("apply_arrow_r_metadata doesn't add in metadata
from plain data.frame
expect_null(attr(spicy_df_no_metadata$num, "format.spss"))
expect_equal(attr(spicy_df_with_metadata$num, "format.spss"), "F8.2")
})
+
+test_that("metadata keys starting with 'r' don't cause partial matching -
GH-50163", {
+ tbl <- arrow_table(x = 1:3)
+ tbl <- tbl$cast(tbl$schema$WithMetadata(list(rachel = "some_value")))
Review Comment:
Thanks for this!
--
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]