ianmcook commented on a change in pull request #9521: URL: https://github.com/apache/arrow/pull/9521#discussion_r582272371
########## File path: r/R/dplyr.R ########## @@ -337,21 +408,20 @@ restore_dplyr_features <- function(df, query) { # After calling collect(), make sure these features are carried over grouped <- length(query$group_by_vars) > 0 - renamed <- !identical(names(df), names(query)) - if (is.data.frame(df)) { + renamed <- ncol(df) && !identical(names(df), names(query)) + if (renamed) { # In case variables were renamed, apply those names - if (renamed && ncol(df)) { - names(df) <- names(query) - } + names(df) <- names(query) + } + if (grouped) { # Preserve groupings, if present Review comment: This got me thinking it'd be cool if groupings were preserved going in the other direction. I opened ARROW-11769. ---------------------------------------------------------------- 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