Skip to content

Commit

Permalink
Merge pull request #277 from tidyverse/f-sync
Browse files Browse the repository at this point in the history
chore: Sync patches
  • Loading branch information
krlmlr authored Oct 17, 2024
2 parents acde65d + 7bf52c1 commit bac5f8e
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 24 deletions.
4 changes: 2 additions & 2 deletions patch/anti_join.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/anti_join.R a/R/anti_join.R
index 02a430b5..5801b310 100644
index 02a430b5..dfb51d99 100644
--- b/R/anti_join.R
+++ a/R/anti_join.R
@@ -1,17 +1,24 @@
Expand All @@ -16,7 +16,7 @@ index 02a430b5..5801b310 100644
# Our implementation
- rel_try(
- "No relational implementation for anti_join()" = TRUE,
+ rel_try(call = list(name = "anti_join", x = x, y = y, args = list(by = if(!is.null(by)) as_join_by(by), copy = copy, na_matches = na_matches)),
+ rel_try(call = list(name = "anti_join", x = x, y = y, args = list(by = if(!is.null(by) && !is_cross_by(by)) as_join_by(by), copy = copy, na_matches = na_matches)),
{
+ out <- rel_join_impl(x, y, by, "anti", na_matches, error_call = error_call)
return(out)
Expand Down
22 changes: 10 additions & 12 deletions patch/count.patch
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
diff --git b/R/count.R a/R/count.R
index 0b855695..ab4d26a0 100644
index 0b855695..8e76fc03 100644
--- b/R/count.R
+++ a/R/count.R
@@ -1,14 +1,51 @@
@@ -1,14 +1,49 @@
# Generated by 02-duckplyr_df-methods.R
#' @export
count.duckplyr_df <- function(x, ..., wt = NULL, sort = FALSE, name = NULL, .drop = group_by_drop_default(x)) {
Expand All @@ -19,20 +19,18 @@ index 0b855695..ab4d26a0 100644
+ by_exprs <- unname(map(by, quo_get_expr))
+ is_name <- map_lgl(by_exprs, is_symbol)
+
+ rel_try(call = list(name = "count", x = x, args = list(dots = enquos(...), wt = enquo(wt), sort = sort, name = if (!is.null(name)) sym(name), .drop = .drop)),
+ by_chr <- map_chr(by_exprs, as_string)
+ name_was_null <- is.null(name)
+ name <- check_n_name(name, by_chr, call = dplyr_error_call())
+
+ n <- tally_n(x, {{ wt }})
+
+ rel_try(call = list(name = "count", x = x, args = list(dots = enquos(...), wt = enquo(wt), sort = sort, name = if (!name_was_null) sym(name), .drop = .drop)),
+ "count() needs all(is_name)" = !all(is_name),
+ "count() only implemented for .drop = TRUE" = !.drop,
+ "count() only implemented for sort = FALSE" = sort,
+ "Name clash in count()" = (name %in% by_chr),
{
+ by_chr <- map_chr(by_exprs, as_string)
+ name <- check_n_name(name, by_chr)
+
+ if (name %in% by_chr) {
+ cli::cli_abort("Name clash in `count()`")
+ }
+
+ n <- tally_n(x, {{ wt }})
+
+ rel <- duckdb_rel_from_df(x)
+
+ groups <- rel_translate_dots(by, x)
Expand Down
4 changes: 2 additions & 2 deletions patch/full_join.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/full_join.R a/R/full_join.R
index ef65f78a..63b3fdaf 100644
index ef65f78a..afd19875 100644
--- b/R/full_join.R
+++ a/R/full_join.R
@@ -1,17 +1,22 @@
Expand All @@ -13,7 +13,7 @@ index ef65f78a..63b3fdaf 100644
# Our implementation
- rel_try(
- "No relational implementation for full_join()" = TRUE,
+ rel_try(call = list(name = "full_join", x = x, y = y, args = list(by = if(!is.null(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, relationship = relationship)),
+ rel_try(call = list(name = "full_join", x = x, y = y, args = list(by = if(!is.null(by) && !is_cross_by(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, relationship = relationship)),
+ "No implicit cross joins for full_join()" = is_cross_by(by),
{
+ out <- rel_join_impl(x, y, by, "full", na_matches, suffix, keep, error_call)
Expand Down
4 changes: 2 additions & 2 deletions patch/inner_join.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/inner_join.R a/R/inner_join.R
index 9c26eacb..48e82a1d 100644
index 9c26eacb..000e6e0d 100644
--- b/R/inner_join.R
+++ a/R/inner_join.R
@@ -1,17 +1,22 @@
Expand All @@ -13,7 +13,7 @@ index 9c26eacb..48e82a1d 100644
# Our implementation
- rel_try(
- "No relational implementation for inner_join()" = TRUE,
+ rel_try(call = list(name = "inner_join", x = x, y = y, args = list(by = if(!is.null(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, unmatched = unmatched, relationship = relationship)),
+ rel_try(call = list(name = "inner_join", x = x, y = y, args = list(by = if(!is.null(by) && !is_cross_by(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, unmatched = unmatched, relationship = relationship)),
+ "No implicit cross joins for inner_join()" = is_cross_by(by),
{
+ out <- rel_join_impl(x, y, by, "inner", na_matches, suffix, keep, error_call)
Expand Down
4 changes: 2 additions & 2 deletions patch/left_join.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/left_join.R a/R/left_join.R
index d5e954be..aec81a64 100644
index d5e954be..c527d647 100644
--- b/R/left_join.R
+++ a/R/left_join.R
@@ -1,17 +1,22 @@
Expand All @@ -13,7 +13,7 @@ index d5e954be..aec81a64 100644
# Our implementation
- rel_try(
- "No relational implementation for left_join()" = TRUE,
+ rel_try(call = list(name = "left_join", x = x, y = y, args = list(by = if(!is.null(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, unmatched = unmatched, relationship = relationship)),
+ rel_try(call = list(name = "left_join", x = x, y = y, args = list(by = if(!is.null(by) && !is_cross_by(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, unmatched = unmatched, relationship = relationship)),
+ "No implicit cross joins for left_join()" = is_cross_by(by),
{
+ out <- rel_join_impl(x, y, by, "left", na_matches, suffix, keep, error_call)
Expand Down
4 changes: 2 additions & 2 deletions patch/right_join.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/right_join.R a/R/right_join.R
index b3c5399e..49380684 100644
index b3c5399e..01cf7594 100644
--- b/R/right_join.R
+++ a/R/right_join.R
@@ -1,17 +1,22 @@
Expand All @@ -13,7 +13,7 @@ index b3c5399e..49380684 100644
# Our implementation
- rel_try(
- "No relational implementation for right_join()" = TRUE,
+ rel_try(call = list(name = "right_join", x = x, y = y, args = list(by = if(!is.null(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, unmatched = unmatched, relationship = relationship)),
+ rel_try(call = list(name = "right_join", x = x, y = y, args = list(by = if(!is.null(by) && !is_cross_by(by)) as_join_by(by), copy = copy, keep = keep, na_matches = na_matches, multiple = multiple, unmatched = unmatched, relationship = relationship)),
+ "No implicit cross joins for right_join()" = is_cross_by(by),
{
+ out <- rel_join_impl(x, y, by, "right", na_matches, suffix, keep, error_call)
Expand Down
4 changes: 2 additions & 2 deletions patch/semi_join.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git b/R/semi_join.R a/R/semi_join.R
index e8259a70..2dccf2a4 100644
index e8259a70..843447ec 100644
--- b/R/semi_join.R
+++ a/R/semi_join.R
@@ -1,17 +1,24 @@
Expand All @@ -16,7 +16,7 @@ index e8259a70..2dccf2a4 100644
# Our implementation
- rel_try(
- "No relational implementation for semi_join()" = TRUE,
+ rel_try(call = list(name = "semi_join", x = x, y = y, args = list(by = if(!is.null(by)) as_join_by(by), copy = copy, na_matches = na_matches)),
+ rel_try(call = list(name = "semi_join", x = x, y = y, args = list(by = if(!is.null(by) && !is_cross_by(by)) as_join_by(by), copy = copy, na_matches = na_matches)),
{
+ out <- rel_join_impl(x, y, by, "semi", na_matches, error_call = error_call)
return(out)
Expand Down

0 comments on commit bac5f8e

Please sign in to comment.