romainfrancois commented on a change in pull request #8150: URL: https://github.com/apache/arrow/pull/8150#discussion_r486191107
########## 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: Perhaps this would be better handled by converting the POSIXlt to a Timestamp array rather than a struct type, because on the way back the struct type makes a data frame which needs the `row.names` attribute. ``` r library(arrow, warn.conflicts = TRUE) example_with_times <- tibble::tibble( posixlt = as.POSIXlt(lubridate::ymd_hms("2018-10-07 19:04:05") + 1:10), ) rb <- record_batch(example_with_times) attributes(as.data.frame(rb)$posixlt) #> $row.names #> [1] 1 2 3 4 5 6 7 8 9 10 #> #> $names #> [1] "sec" "min" "hour" "mday" "mon" "year" "wday" "yday" "isdst" #> #> $class #> [1] "POSIXlt" "POSIXt" #> #> $tzone #> [1] "UTC" attributes(example_with_times$posixlt) #> $names #> [1] "sec" "min" "hour" "mday" "mon" "year" "wday" "yday" "isdst" #> #> $class #> [1] "POSIXlt" "POSIXt" #> #> $tzone #> [1] "UTC" ``` <sup>Created on 2020-09-10 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0.9001)</sup> ---------------------------------------------------------------- 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: us...@infra.apache.org