Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7880 +/- ##
=======================================
Coverage 99.01% 99.01%
=======================================
Files 88 88
Lines 17309 17327 +18
=======================================
+ Hits 17139 17157 +18
Misses 170 170 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Generated via commit 4c053c0 Download link for the artifact containing the test results: ↓ atime-results.zip
|
jangorecki
left a comment
There was a problem hiding this comment.
what is f stands for? fast?
for this case it somehow feels that row-in could be more appropriate, %rin%
| # %fin% operator | ||
| x = data.table(name=c("A","B","C"), year=c(2020,2020,2021)) | ||
| y = data.table(name=c("A","B"), year=c(2020,2020)) | ||
| x[, found := .(name, year) \%fin\% y] |
There was a problem hiding this comment.
I would add simpler example first, basic x %in% y, without [
| x = as.data.table(x) | ||
| } else if (!is.data.table(x)) { | ||
| x = as.data.table(list(x)) | ||
| setnames(x, names(y)[1]) |
There was a problem hiding this comment.
using 1L here as well should be preferred
| setnames(x, names(y)[1]) | ||
| } | ||
| join_cols = names(x) | ||
| if (!all(join_cols %in% names(y))) { |
There was a problem hiding this comment.
should we stop in case there are duplicates in column names within one table?
| test(2388.05, data.table(name=c("A","B"),year=c(2020,2021),grade=c(8,9)) %fin% data.table(name=c("A","B"),year=c(2020,2021)), error="All columns in the left-hand side") | ||
| test(2388.06, data.table(name=c("A","B"),year=c(2020,2021),grade=c(8,9)) %fin% data.table(name=c("A","B"),year=c(2020,2021),grade=c(8,9),extra=c(1,2)), c(TRUE,TRUE)) | ||
| test(2388.07, list(name=c("A","B"), year=c(2020,2022)) %fin% y, c(TRUE,FALSE)) | ||
| test(2388.08, c("A","B") %fin% y[, .(name)], c(TRUE,TRUE)) |
There was a problem hiding this comment.
I don't see a test where y has duplicates, and then also x and y both have duplicates on fields they need to join.
|
I'm also not sure that %in% is the right naming here, especially since I'm still convinced for the %fin% operator of this issue #5232 |
|
@ben-schwen whyt if "your" %fin% would address this request? it would act as a more generic router than just in/chin |
Could be. But I need to think it over more carefully. From top of my head the main difference is that this PR uses joins (based on sorting) while the other %fin% will be using hash maps (in both the |

closes #2279
adds the
%fin%operator to perform optimized row-wise existence checks betweendata.tables. It supports multi-column matching usingdata.tablejoin semantics and allows for the requested .(col1, col2)%fin%ysyntax.