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

feat: Add maintain_order parameter to joins #20026

Merged
merged 17 commits into from
Dec 6, 2024

Conversation

stijnherfst
Copy link
Collaborator

@stijnherfst stijnherfst commented Nov 27, 2024

The API docs specify the ordering for left joins as preserving the order of the left Dataframe. In some cases it can be useful to also have this property for other types of joins and in other cases having no required ordering can allow for performance optimizations.

@github-actions github-actions bot added enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars labels Nov 27, 2024
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 92.00000% with 18 lines in your changes missing coverage. Please review.

Project coverage is 79.64%. Comparing base (bf8f64c) to head (c13a78b).
Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
...s/polars-ops/src/frame/join/dispatch_left_right.rs 93.33% 8 Missing ⚠️
crates/polars-ops/src/frame/join/mod.rs 89.74% 4 Missing ⚠️
crates/polars-python/src/conversion/mod.rs 69.23% 4 Missing ⚠️
crates/polars-ops/src/frame/join/args.rs 66.66% 1 Missing ⚠️
crates/polars-ops/src/frame/join/hash_join/mod.rs 96.55% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20026      +/-   ##
==========================================
+ Coverage   79.54%   79.64%   +0.10%     
==========================================
  Files        1564     1564              
  Lines      217211   217638     +427     
  Branches     2465     2475      +10     
==========================================
+ Hits       172771   173342     +571     
+ Misses      43879    43727     -152     
- Partials      561      569       +8     

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

crates/polars-lazy/src/frame/mod.rs Outdated Show resolved Hide resolved
crates/polars-lazy/src/frame/mod.rs Outdated Show resolved Hide resolved
crates/polars-ops/src/frame/join/args.rs Outdated Show resolved Hide resolved
py-polars/polars/dataframe/frame.py Outdated Show resolved Hide resolved
py-polars/polars/lazyframe/frame.py Outdated Show resolved Hide resolved
crates/polars-ops/src/frame/join/args.rs Outdated Show resolved Hide resolved
crates/polars-core/src/frame/mod.rs Outdated Show resolved Hide resolved
crates/polars-ops/src/frame/join/dispatch_left_right.rs Outdated Show resolved Hide resolved
py-polars/polars/_typing.py Outdated Show resolved Hide resolved
@@ -57,7 +57,7 @@ impl NodeTraverser {
// Increment major on breaking changes to the IR (e.g. renaming
// fields, reordering tuples), minor on backwards compatible
// changes (e.g. exposing a new expression node).
const VERSION: Version = (3, 2);
const VERSION: Version = (4, 0);
Copy link
Member

Choose a reason for hiding this comment

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

I don't think this is a breaking IR change, but a minor version bump.

Copy link
Collaborator

Choose a reason for hiding this comment

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

We changed the structure of the tuple in the join options (one more field)

Copy link
Member

@ritchie46 ritchie46 left a comment

Choose a reason for hiding this comment

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

Looks great. I have left a few minor comments.

Could you also change the python type to None | MaintainOrder?

@ritchie46 ritchie46 changed the title feat: Add maintain_order parameter to joins feat: Add maintain_order parameter to joins Dec 6, 2024
@ritchie46 ritchie46 enabled auto-merge (squash) December 6, 2024 08:46
@ritchie46 ritchie46 disabled auto-merge December 6, 2024 09:00
@ritchie46 ritchie46 merged commit e9ddd37 into pola-rs:main Dec 6, 2024
26 checks passed
@alexander-beedie
Copy link
Collaborator

Good stuff :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or an improvement of an existing feature python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants