Skip to content

Commit e3b23cd

Browse files
committed
feat: Move auto_copy() to avoid error for misplaced copy argument
1 parent 5636009 commit e3b23cd

File tree

7 files changed

+11
-12
lines changed

7 files changed

+11
-12
lines changed

R/anti_join.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
anti_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, ..., na_matches = c("na", "never")) {
44
check_dots_empty0(...)
55
error_call <- caller_env()
6-
y <- auto_copy(x, y, copy = copy)
76

87
# https://github.com/duckdb/duckdb/issues/6597
98
na_matches <- check_na_matches(na_matches, error_call = error_call)
@@ -12,7 +11,7 @@ anti_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, ..., na_matches
1211
rel_try(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)),
1312
"No restrictions" = FALSE,
1413
{
15-
out <- rel_join_impl(x, y, by, "anti", na_matches, error_call = error_call)
14+
out <- rel_join_impl(x, y, by, copy, "anti", na_matches, error_call = error_call)
1615
return(out)
1716
}
1817
)

R/full_join.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
full_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ..., keep = NULL, na_matches = c("na", "never"), multiple = "all", relationship = NULL) {
44
check_dots_empty0(...)
55
error_call <- caller_env()
6-
y <- auto_copy(x, y, copy = copy)
76

87
# Our implementation
98
rel_try(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)),
109
"No implicit cross joins for full_join()" = is_cross_by(by),
1110
{
12-
out <- rel_join_impl(x, y, by, "full", na_matches, suffix, keep, error_call)
11+
out <- rel_join_impl(x, y, by, copy, "full", na_matches, suffix, keep, error_call)
1312
return(out)
1413
}
1514
)

R/inner_join.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
inner_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ..., keep = NULL, na_matches = c("na", "never"), multiple = "all", unmatched = "drop", relationship = NULL) {
44
check_dots_empty0(...)
55
error_call <- caller_env()
6-
y <- auto_copy(x, y, copy = copy)
76

87
# Our implementation
98
rel_try(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)),
109
"No implicit cross joins for inner_join()" = is_cross_by(by),
1110
{
12-
out <- rel_join_impl(x, y, by, "inner", na_matches, suffix, keep, error_call)
11+
out <- rel_join_impl(x, y, by, copy, "inner", na_matches, suffix, keep, error_call)
1312
return(out)
1413
}
1514
)

R/join.R

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,17 @@ rel_join_impl <- function(
22
x,
33
y,
44
by,
5+
copy,
56
join,
67
na_matches,
78
suffix = c(".x", ".y"),
89
keep = NULL,
910
error_call = caller_env()
1011
) {
12+
# Forcing copy might be an error, fall back in this case
13+
# Examples: joyn, gtsummary, crosshap
14+
y <- auto_copy(x, y, copy = copy)
15+
1116
mutating <- !(join %in% c("semi", "anti"))
1217

1318
if (mutating) {

R/left_join.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
left_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ..., keep = NULL, na_matches = c("na", "never"), multiple = "all", unmatched = "drop", relationship = NULL) {
44
check_dots_empty0(...)
55
error_call <- caller_env()
6-
y <- auto_copy(x, y, copy = copy)
76

87
# Our implementation
98
rel_try(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)),
109
"No implicit cross joins for left_join()" = is_cross_by(by),
1110
{
12-
out <- rel_join_impl(x, y, by, "left", na_matches, suffix, keep, error_call)
11+
out <- rel_join_impl(x, y, by, copy, "left", na_matches, suffix, keep, error_call)
1312
return(out)
1413
}
1514
)

R/right_join.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@
33
right_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, suffix = c(".x", ".y"), ..., keep = NULL, na_matches = c("na", "never"), multiple = "all", unmatched = "drop", relationship = NULL) {
44
check_dots_empty0(...)
55
error_call <- caller_env()
6-
y <- auto_copy(x, y, copy = copy)
76

87
# Our implementation
98
rel_try(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)),
109
"No implicit cross joins for right_join()" = is_cross_by(by),
1110
{
12-
out <- rel_join_impl(x, y, by, "right", na_matches, suffix, keep, error_call)
11+
out <- rel_join_impl(x, y, by, copy, "right", na_matches, suffix, keep, error_call)
1312
return(out)
1413
}
1514
)

R/semi_join.R

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
semi_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, ..., na_matches = c("na", "never")) {
44
check_dots_empty0(...)
55
error_call <- caller_env()
6-
y <- auto_copy(x, y, copy = copy)
76

87
# https://github.com/duckdb/duckdb/issues/6597
98
na_matches <- check_na_matches(na_matches, error_call = error_call)
@@ -12,7 +11,7 @@ semi_join.duckplyr_df <- function(x, y, by = NULL, copy = FALSE, ..., na_matches
1211
rel_try(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)),
1312
"No restrictions" = FALSE,
1413
{
15-
out <- rel_join_impl(x, y, by, "semi", na_matches, error_call = error_call)
14+
out <- rel_join_impl(x, y, by, copy, "semi", na_matches, error_call = error_call)
1615
return(out)
1716
}
1817
)

0 commit comments

Comments
 (0)