eitsupi commented on code in PR #14175:
URL: https://github.com/apache/arrow/pull/14175#discussion_r975560514
##########
r/R/dplyr-collect.R:
##########
@@ -60,20 +62,23 @@ 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) {
+ if (is.data.frame(df)) {
# Preserve groupings, if present
- if (is.data.frame(df)) {
+ if (length(query$group_by_vars) > 0) {
df <- dplyr::grouped_df(
df,
dplyr::group_vars(query),
drop = dplyr::group_by_drop_default(query)
)
+ }
+ } else {
+ # This is a Table, via compute() or collect(as_data_frame = FALSE)
+ if (length(query$group_by_vars) > 0) {
+ gv <- query$group_by_vars
} else {
- # This is a Table, via compute() or collect(as_data_frame = FALSE)
- df <- as_adq(df)
- df$group_by_vars <- query$group_by_vars
- df$drop_empty_groups <- query$drop_empty_groups
+ gv <- NULL
Review Comment:
Perhaps `restore_dplyr_features` should make sure that `df` is not grouped.
If it is guaranteed that `df` is not grouped, this case will be unnecessary.
--
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]