Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semi_join does not coerce y to lazy_dt #322

Closed
dakvid opened this issue Dec 8, 2021 · 2 comments · Fixed by #334
Closed

semi_join does not coerce y to lazy_dt #322

dakvid opened this issue Dec 8, 2021 · 2 comments · Fixed by #334

Comments

@dakvid
Copy link

dakvid commented Dec 8, 2021

Version 1.2.0 has some great new features, but has broken semi_join (or all my uses of it anyway 😀) as the second argument is no longer coerced from a data.table to a lazy_dt. The error message didn't make any sense until I came across #278 but that helped me deduce what was happening.

library(dplyr, warn.conflicts = FALSE)      # 1.0.7
library(data.table, warn.conflicts = FALSE) # 1.14.2
library(dtplyr, warn.conflicts = FALSE)     # 1.2.0

x <- data.table(a = 1:4, b = c(1:2, 1:2))
y <- data.table(b = 2L)

inner_join(x, y)
#> Joining, by = "b"
#> Source: local data table [2 x 2]
#> Call:   `_DT1`[`_DT2`, on = .(b), nomatch = NULL, allow.cartesian = TRUE]
#> 
#>       a     b
#>   <int> <int>
#> 1     2     2
#> 2     4     2
#> 
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
full_join(x, y)
#> Joining, by = "b"
#> Source: local data table [4 x 2]
#> Call:   setcolorder(merge(`_DT3`, `_DT4`, all = TRUE, by.x = "b", by.y = "b", 
#>     allow.cartesian = TRUE), 2:1)
#> 
#>       a     b
#>   <int> <int>
#> 1     1     1
#> 2     3     1
#> 3     2     2
#> 4     4     2
#> 
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
anti_join(x, y)
#> Joining, by = "b"
#> Source: local data table [2 x 2]
#> Call:   `_DT5`[!`_DT6`, on = .(b)]
#> 
#>       a     b
#>   <int> <int>
#> 1     1     1
#> 2     3     1
#> 
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
semi_join(x, y)
#> Error in step_join(x, y, on = by, style = "semi"): is_step(y) is not TRUE
semi_join(x, y %>% lazy_dt())
#> Joining, by = "b"
#> Source: local data table [2 x 2]
#> Call:   `_DT8`[unique(`_DT8`[`_DT9`, which = TRUE, nomatch = NULL, on = .(b)])]
#> 
#>       a     b
#>   <int> <int>
#> 1     2     2
#> 2     4     2
#> 
#> # Use as.data.table()/as.data.frame()/as_tibble() to access results
@dakvid
Copy link
Author

dakvid commented Feb 7, 2022

Thank you! 🙏

@mgirlich
Copy link
Collaborator

mgirlich commented Feb 7, 2022

You're welcome 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants