diff --git a/R/summarise.R b/R/summarise.R index 37ab9505..aea4a716 100644 --- a/R/summarise.R +++ b/R/summarise.R @@ -6,20 +6,20 @@ summarise.duckplyr_df <- function(.data, ..., .by = NULL, .groups = NULL) { rel_try( 'summarize(.groups = "rowwise") not supported' = identical(.groups, "rowwise"), { + rel <- duckdb_rel_from_df(.data) + by <- eval_select_by(enquo(.by), .data) - oo <- (length(by) > 0) && oo_force() - rel <- duckdb_rel_from_df(.data) + dots <- dplyr_quosures(...) + dots <- fix_auto_name(dots) + oo <- (length(by) > 0) && oo_force() if (oo) { rel <- oo_prep(rel, colname = "___row_number", force = TRUE) } - dots <- dplyr_quosures(...) - dots <- fix_auto_name(dots) - - aggregates <- rel_translate_dots(dots, .data) groups <- lapply(by, relexpr_reference) + aggregates <- rel_translate_dots(dots, .data) if (oo) { aggregates <- c( diff --git a/patch/summarise.patch b/patch/summarise.patch index 5b8cb946..2323131f 100644 --- a/patch/summarise.patch +++ b/patch/summarise.patch @@ -1,5 +1,5 @@ diff --git b/R/summarise.R a/R/summarise.R -index 482068f..37ab950 100644 +index 482068f..aea4a71 100644 --- b/R/summarise.R +++ a/R/summarise.R @@ -1,10 +1,50 @@ @@ -13,20 +13,20 @@ index 482068f..37ab950 100644 - "No relational implementation for summarise()" = TRUE, + 'summarize(.groups = "rowwise") not supported' = identical(.groups, "rowwise"), { ++ rel <- duckdb_rel_from_df(.data) ++ + by <- eval_select_by(enquo(.by), .data) -+ oo <- (length(by) > 0) && oo_force() + -+ rel <- duckdb_rel_from_df(.data) ++ dots <- dplyr_quosures(...) ++ dots <- fix_auto_name(dots) + ++ oo <- (length(by) > 0) && oo_force() + if (oo) { + rel <- oo_prep(rel, colname = "___row_number", force = TRUE) + } + -+ dots <- dplyr_quosures(...) -+ dots <- fix_auto_name(dots) -+ -+ aggregates <- rel_translate_dots(dots, .data) + groups <- lapply(by, relexpr_reference) ++ aggregates <- rel_translate_dots(dots, .data) + + if (oo) { + aggregates <- c(