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: Properly update groups after gather in aggregation context #21369

Merged
merged 1 commit into from
Feb 21, 2025

Conversation

JakubValtar
Copy link
Contributor

I traced #21178 down to gather in aggregation context not updating the groups properly.

This PR makes sure the groups are updated, otherwise this causes wrong results or OOB access in the following operation. I checked that each changed line fixes the matching test.

I added Python tests to cover each of the changed lines, but they are a bit fragile, since there is no guarantee they will keep triggering this Rust code in the future. Is there a better way I can write the tests, maybe as Rust unit tests?

Closes #21178

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Feb 20, 2025
Copy link

codecov bot commented Feb 20, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.90%. Comparing base (fb28c07) to head (a5d1c92).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21369      +/-   ##
==========================================
- Coverage   79.91%   79.90%   -0.01%     
==========================================
  Files        1597     1597              
  Lines      228713   228715       +2     
  Branches     2618     2618              
==========================================
- Hits       182767   182760       -7     
- Misses      45347    45356       +9     
  Partials      599      599              

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

@ritchie46
Copy link
Member

ritchie46 commented Feb 21, 2025

That's a nasty one.

I added Python tests to cover each of the changed lines, but they are a bit fragile, since there is no guarantee they will keep triggering this Rust code in the future. Is there a better way I can write the tests, maybe as Rust unit tests?

The preferred tests are Python tests, but if you are not sure you can hit it (or think it will change), a unit test in the crate is also fine.

I will merge this regardless. If we do a release this afternoon, it's great to have this included. Thanks a lot!

@ritchie46 ritchie46 merged commit ce9d403 into pola-rs:main Feb 21, 2025
28 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.

Nonsensical result when doing a gather and then first in aggregation context
2 participants