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: Arguments for upsample only have to be sorted within groups #18264

Conversation

thomascamminady
Copy link
Contributor

In the case of group_by being provide as an extra argument to upsample, the index needs to be only sorted within those groups. This tries to fix the issue observed in #18229.

Tests are added to check that

  • No error occurs if the index is only sorted within groups and groups are provided.
  • An error occurs if the index is only sorted within groups and no groups are provided.

Note, this is my first commit and I am not a Rust developer.

In the case of `group_by` being provide as an extra argument to `upsample`, the index needs to be only sorted within those groups.
@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Aug 19, 2024
Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.22%. Comparing base (c88da1f) to head (e6fced6).
Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #18264   +/-   ##
=======================================
  Coverage   80.21%   80.22%           
=======================================
  Files        1500     1500           
  Lines      198897   198897           
  Branches     2837     2837           
=======================================
+ Hits       159547   159566   +19     
+ Misses      38822    38803   -19     
  Partials      528      528           

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

Simplify the testing for the newly added tests to only test newly added functionality.
Comment on lines 124 to 126
s.ensure_sorted_arg("upsample")?;
if by.is_empty() {
s.ensure_sorted_arg("upsample")?;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

thanks for your PR!

does it work to move this check into upsample_single_impl?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks! That was indeed the cleaner way to do it.

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 good. Thanks!

@ritchie46 ritchie46 merged commit 8d43ba1 into pola-rs:main Aug 20, 2024
26 checks passed
@thomascamminady thomascamminady deleted the feature/Issue18229_upsample_should_work_if_args_are_sorted_within_group branch August 20, 2024 07:52
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.

3 participants