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: Check shape for *_horizontal functions #20130

Merged

Conversation

coastalwhite
Copy link
Collaborator

Fixes #19336.

There was some unsoundness before when creating the frame that has now be resolved.

This also moves pl.DataFrame.*_horizontal functions away from their own custom implementation and towards using pl.select(_ = pl.*_horizontal).

Fixes pola-rs#19336.

There was some unsoundness before when creating the frame that has now be
resolved.

This also moves pl.DataFrame.*_horizontal functions away from their own custom
implementation and towards using `pl.select(_ = pl.*_horizontal)`.
@coastalwhite coastalwhite changed the title fix: Check shape for *_horizontal functions fix: Check shape for *_horizontal functions Dec 3, 2024
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Dec 3, 2024
Copy link

codecov bot commented Dec 3, 2024

Codecov Report

Attention: Patch coverage is 95.34884% with 10 lines in your changes missing coverage. Please review.

Project coverage is 79.52%. Comparing base (0263868) to head (d7e267d).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
...es/polars-core/src/series/arithmetic/horizontal.rs 96.59% 5 Missing ⚠️
.../polars-python/src/lazyframe/visitor/expr_nodes.rs 0.00% 4 Missing ⚠️
crates/polars-plan/src/dsl/function_expr/mod.rs 80.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #20130   +/-   ##
=======================================
  Coverage   79.52%   79.52%           
=======================================
  Files        1563     1564    +1     
  Lines      217184   217194   +10     
  Branches     2465     2465           
=======================================
+ Hits       172706   172728   +22     
+ Misses      43917    43905   -12     
  Partials      561      561           

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

let sum = || sum_horizontal(&columns, null_strategy);
let null_count = || {
columns
.par_iter()
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this in core, if we could store it in polars-ops that wuold be preferred.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It would remove the sum_horizontal, mean_horizontal, ... methods from the DataFrame methods. If you are okay with that, I can do it.

Copy link
Member

Choose a reason for hiding this comment

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

We could TraitExt them in ops?

Copy link
Member

Choose a reason for hiding this comment

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

We could decide to do that in a future PR. I think it's worth it.

@ritchie46 ritchie46 merged commit cc05ff2 into pola-rs:main Dec 3, 2024
26 checks passed
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
Development

Successfully merging this pull request may close these issues.

sum_horizontal + list.explode PanicException instead of ShapeError
2 participants