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

fix: Incorrect .join(..., how="left").head(N) if N <= left_df.height() and there are duplicate matches #19422

Merged
merged 4 commits into from
Oct 24, 2024

Conversation

nameexhaustion
Copy link
Collaborator

@nameexhaustion nameexhaustion commented Oct 24, 2024

Fixes #19405
Fixes #19403

A long time ago a fast-path was added to left-join that would identify a left-join didn't have any duplicate matches by checking the height of the join_tuples matches the height of the input DF:

2f5f3ec#diff-33db4b397429a6dc2297400e2fe812fb12f17ed977dfeee5f96e34fdb9b05757R728-R730

At some point we added slicing to the input left DF and also the join tuples, meaning that we would incorrectly identify the left-join as having no duplicate matches.

@nameexhaustion nameexhaustion changed the title fix: Incorrect .join(..., how="left").head(N) if N <= left_df.height() fix: Incorrect .join(..., how="left").head(N) if N <= left_df.height() and there are duplicate matches Oct 24, 2024
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Oct 24, 2024
@@ -104,6 +104,7 @@ all = [
"parquet",
"ipc",
"polars-python/all",
"performant",
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code-path for left join on sorted keys is also affected, but it is gated behind the performant feature flag so it doesn't get compiled in debug builds.

I think maybe instead of adding it here, we can add a test step to the Python release workflow that runs through the test suite with the optimized release build?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I assumed it was always included in pypolars. It should always be activated.

Copy link

codecov bot commented Oct 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.04%. Comparing base (69c9c3a) to head (7db2627).
Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #19422   +/-   ##
=======================================
  Coverage   80.03%   80.04%           
=======================================
  Files        1532     1532           
  Lines      210749   210766   +17     
  Branches     2442     2442           
=======================================
+ Hits       168676   168701   +25     
+ Misses      41518    41510    -8     
  Partials      555      555           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ritchie46 ritchie46 merged commit 3fe25c5 into pola-rs:main Oct 24, 2024
25 checks passed
@wence-
Copy link
Collaborator

wence- commented Oct 25, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix Bug fix python Related to Python Polars rust Related to Rust Polars
Projects
None yet
3 participants