romainfrancois commented on a change in pull request #8150:
URL: https://github.com/apache/arrow/pull/8150#discussion_r486197783



##########
File path: r/R/record-batch.R
##########
@@ -278,7 +278,10 @@ as.data.frame.RecordBatch <- function(x, row.names = NULL, 
optional = FALSE, ...
 apply_arrow_r_metadata <- function(x, r_metadata) {
   tryCatch({
     if (!is.null(r_metadata$attributes)) {
-      attributes(x) <- r_metadata$attributes
+      attributes(x)[names(r_metadata$attributes)] <- r_metadata$attributes
+      if (inherits(x, "POSIXlt")) {
+        attr(x, "row.names") <- NULL

Review comment:
       Alternatively the test could use `expect_equal()` instead of 
`expect_identical()` and we would leave the `row.names` attribute: 
   
   ```r
   test_that("Date/time type roundtrip", {
     rb <- record_batch(example_with_times)
     expect_is(rb$schema$posixlt$type, "StructType")
     expect_equal(as.data.frame(rb), example_with_times)
   })
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to