-
-
Notifications
You must be signed in to change notification settings - Fork 27
Add how="leftanti" support for cudf-backed merge
#1073
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
base: main
Are you sure you want to change the base?
Changes from 2 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ | |
| from dask_expr._merge import BroadcastJoin | ||
| from dask_expr._shuffle import Shuffle | ||
| from dask_expr.io import FromPandas | ||
| from dask_expr.tests._util import _backend_library, assert_eq | ||
| from dask_expr.tests._util import _backend_library, _backend_name, assert_eq | ||
|
|
||
| # Set DataFrame backend for this module | ||
| pd = _backend_library() | ||
|
|
@@ -996,6 +996,33 @@ def test_merge_leftsemi(): | |
| df1.merge(df2, how="leftsemi", on="aa") | ||
|
|
||
|
|
||
| @pytest.mark.xfail( | ||
| _backend_name() != "cudf", reason="leftanti joins not supported with pandas backend" | ||
| ) | ||
| def test_merge_leftanti_cudf(): | ||
| pdf1 = pd.DataFrame({"aa": [1, 2, 3, 4, 5, 6, 1, 2, 3], "bb": 1}) | ||
| pdf2 = pd.DataFrame({"aa": [1, 2, 2, 4, 4, 10], "cc": 1}) | ||
|
|
||
| df1 = from_pandas(pdf1, npartitions=2) | ||
| df2 = from_pandas(pdf2, npartitions=2) | ||
| assert_eq( | ||
| df1.merge(df2, how="leftanti"), | ||
| pdf1[~pdf1.aa.isin(pdf2.aa)], | ||
| check_index=False, | ||
| ) | ||
| df2 = df2.rename(columns={"aa": "dd"}) | ||
| assert_eq( | ||
| df1.merge(df2, how="leftanti", left_on="aa", right_on="dd"), | ||
| pdf1[~pdf1.aa.isin(pdf2.aa)], | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seems like we could just do this in merge_chunk for pandas data to support
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah good point, can look into this a bit more
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushed some commits to dask/dask#11150 that, in conjunction with this PR, should unblock left anti/semi joins on CPU |
||
| check_index=False, | ||
| ) | ||
| assert_eq(df1.merge(df2, how="leftanti"), pdf1[~pdf1.index.isin(pdf2.index)]) | ||
|
|
||
| pdf2 = pdf2.set_index("aa") | ||
| df2 = from_pandas(pdf2, npartitions=2) | ||
| assert_eq(df1.merge(df2, how="leftanti", on="aa"), pdf1[~pdf1.aa.isin(pdf2.index)]) | ||
|
|
||
|
|
||
| def test_merge_suffix_projections(): | ||
| df = pd.DataFrame( | ||
| { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.