-
Notifications
You must be signed in to change notification settings - Fork 123
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
feat: arrow join methods #558
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
d863827
feat: pyarrow join methods
FBruzzesi 8dd7815
fill_null include type
FBruzzesi 0649c68
Merge remote-tracking branch 'upstream/main' into feat/pyarrow-join-tβ¦
MarcoGorelli 06e26c2
add extra hypothesis test cause im paranoid
MarcoGorelli 7d7a30e
fix typo in err msg
MarcoGorelli File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,15 +37,11 @@ def test_inner_join_single_key(constructor: Any) -> None: | |
compare_dicts(result, expected) | ||
|
||
|
||
def test_cross_join(request: Any, constructor: Any) -> None: | ||
if "pyarrow_table" in str(constructor): | ||
request.applymarker(pytest.mark.xfail) | ||
|
||
def test_cross_join(constructor: Any) -> None: | ||
data = {"a": [1, 3, 2]} | ||
df = nw.from_native(constructor(data)) | ||
result = df.join(df, how="cross") # type: ignore[arg-type] | ||
|
||
expected = {"a": [1, 1, 1, 3, 3, 3, 2, 2, 2], "a_right": [1, 3, 2, 1, 3, 2, 1, 3, 2]} | ||
result = df.join(df, how="cross").sort("a", "a_right") # type: ignore[arg-type] | ||
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. Without sorting, the result is flaky as order is not guaranteed |
||
expected = {"a": [1, 1, 1, 2, 2, 2, 3, 3, 3], "a_right": [1, 2, 3, 1, 2, 3, 1, 2, 3]} | ||
compare_dicts(result, expected) | ||
|
||
with pytest.raises(ValueError, match="Can not pass left_on, right_on for cross join"): | ||
|
@@ -71,15 +67,11 @@ def test_cross_join_non_pandas() -> None: | |
], | ||
) | ||
def test_anti_join( | ||
request: Any, | ||
constructor: Any, | ||
join_key: list[str], | ||
filter_expr: nw.Expr, | ||
expected: dict[str, list[Any]], | ||
) -> None: | ||
if "pyarrow_table" in str(constructor): | ||
request.applymarker(pytest.mark.xfail) | ||
|
||
data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9]} | ||
df = nw.from_native(constructor(data)) | ||
other = df.filter(filter_expr) | ||
|
@@ -96,15 +88,11 @@ def test_anti_join( | |
], | ||
) | ||
def test_semi_join( | ||
request: Any, | ||
constructor: Any, | ||
join_key: list[str], | ||
filter_expr: nw.Expr, | ||
expected: dict[str, list[Any]], | ||
) -> None: | ||
if "pyarrow_table" in str(constructor): | ||
request.applymarker(pytest.mark.xfail) | ||
|
||
data = {"a": [1, 3, 2], "b": [4, 4, 6], "z": [7.0, 8, 9]} | ||
df = nw.from_native(constructor(data)) | ||
other = df.filter(filter_expr) | ||
|
@@ -127,10 +115,7 @@ def test_join_not_implemented(constructor: Any, how: str) -> None: | |
|
||
|
||
@pytest.mark.filterwarnings("ignore:the default coalesce behavior") | ||
def test_left_join(request: Any, constructor: Any) -> None: | ||
if "pyarrow_table" in str(constructor): | ||
request.applymarker(pytest.mark.xfail) | ||
|
||
def test_left_join(constructor: Any) -> None: | ||
data_left = {"a": [1.0, 2, 3], "b": [4.0, 5, 6]} | ||
data_right = {"a": [1.0, 2, 3], "c": [4.0, 5, 7]} | ||
df_left = nw.from_native(constructor(data_left), eager_only=True) | ||
|
@@ -143,10 +128,7 @@ def test_left_join(request: Any, constructor: Any) -> None: | |
|
||
|
||
@pytest.mark.filterwarnings("ignore: the default coalesce behavior") | ||
def test_left_join_multiple_column(request: Any, constructor: Any) -> None: | ||
if "pyarrow_table" in str(constructor): | ||
request.applymarker(pytest.mark.xfail) | ||
|
||
def test_left_join_multiple_column(constructor: Any) -> None: | ||
data_left = {"a": [1, 2, 3], "b": [4, 5, 6]} | ||
data_right = {"a": [1, 2, 3], "c": [4, 5, 6]} | ||
df_left = nw.from_native(constructor(data_left), eager_only=True) | ||
|
@@ -157,12 +139,9 @@ def test_left_join_multiple_column(request: Any, constructor: Any) -> None: | |
|
||
|
||
@pytest.mark.filterwarnings("ignore: the default coalesce behavior") | ||
def test_left_join_overlapping_column(request: Any, constructor: Any) -> None: | ||
if "pyarrow_table" in str(constructor): | ||
request.applymarker(pytest.mark.xfail) | ||
|
||
data_left = {"a": [1, 2, 3], "b": [4, 5, 6], "d": [1, 4, 2]} | ||
data_right = {"a": [1, 2, 3], "c": [4, 5, 6], "d": [1, 4, 2]} | ||
def test_left_join_overlapping_column(constructor: Any) -> None: | ||
data_left = {"a": [1.0, 2, 3], "b": [4.0, 5, 6], "d": [1.0, 4, 2]} | ||
data_right = {"a": [1.0, 2, 3], "c": [4.0, 5, 6], "d": [1.0, 4, 2]} | ||
df_left = nw.from_native(constructor(data_left), eager_only=True) | ||
df_right = nw.from_native(constructor(data_right), eager_only=True) | ||
result = df_left.join(df_right, left_on="b", right_on="c", how="left") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
truly wild
and i love it