thisisnic commented on a change in pull request #12073:
URL: https://github.com/apache/arrow/pull/12073#discussion_r779660661



##########
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:
       Yeah - there are checks for object class in other tests and those began 
to fail.  How about we leave it as is for now, but fix later if other issues 
arise? I wanted to find a simple solution but it's more complex than I thought.




-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to