nealrichardson commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r993767906


##########
r/R/dplyr.R:
##########
@@ -49,6 +49,11 @@ arrow_dplyr_query <- function(.data) {
   if (inherits(.data, "data.frame")) {
     .data <- Table$create(.data)
   }
+  # If .data is a Table, it must be ungrouped (ARROW-17737)

Review Comment:
   ```suggestion
     # ARROW-17737: If .data is a Table, remove groups from metadata
     # (we've already grabbed the groups above)
   ```



##########
r/R/dplyr-collect.R:
##########
@@ -58,17 +58,21 @@ restore_dplyr_features <- function(df, query) {
   # An arrow_dplyr_query holds some attributes that Arrow doesn't know about
   # After calling collect(), make sure these features are carried over
 
-  if (length(query$group_by_vars) > 0) {
-    # Preserve groupings, if present
+  if (length(dplyr::group_vars(df))) {

Review Comment:
   Do we need any of these changes? Seems like the change in dplyr.R should be 
enough.



##########
r/R/dplyr.R:
##########
@@ -49,6 +49,11 @@ arrow_dplyr_query <- function(.data) {
   if (inherits(.data, "data.frame")) {
     .data <- Table$create(.data)
   }
+  # If .data is a Table, it must be ungrouped (ARROW-17737)
+  if (length(group_vars.ArrowTabular(.data))) {
+    .data <- ungroup.ArrowTabular(.data)
+  }

Review Comment:
   Should only do this on Table/RecordBatch
   
   ```suggestion
     if (inherits(.data, "ArrowTabular")) {
       .data <- ungroup.ArrowTabular(.data)
     }
   ```



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

Reply via email to