jonkeane commented on a change in pull request #12073:
URL: https://github.com/apache/arrow/pull/12073#discussion_r779662565
##########
File path: r/R/metadata.R
##########
@@ -133,24 +133,24 @@ remove_attributes <- function(x) {
}
arrow_attributes <- function(x, only_top_level = FALSE) {
+
+ att <- attributes(x)
+ removed_attributes <- remove_attributes(x)
+
if (inherits(x, "grouped_df")) {
# Keep only the group var names, not the rest of the cached data that dplyr
# uses, which may be large
if (requireNamespace("dplyr", quietly = TRUE)) {
gv <- dplyr::group_vars(x)
x <- dplyr::ungroup(x)
# ungroup() first, then set attribute, bc ungroup() would erase it
- attr(x, ".group_vars") <- gv
- } else {
- # Regardless, we shouldn't keep groups around
- attr(x, "groups") <- NULL
+ att[[".group_vars"]] <- gv
+ removed_attributes <- c(removed_attributes, "groups", "class")
Review comment:
Sounds good!
--
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]