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(rust!): Rename ChunkedArray.try_apply to try_apply_values #14947

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Mar 9, 2024

I think this one is named a little misleadingly, as for apply there's:

  • ChunkedArray.apply: run function on non-null values
  • ChunkedArray.apply_values: run function on all values

But ChunkedArray.try_apply runs a fallible function on all values

I'd suggest renaming it to try_apply_values, and then later introducing try_apply which runs a fallible function on non-null values (which would be useful in addressing #11579)

@github-actions github-actions bot added breaking rust Change that breaks backwards compatibility for the Rust crate internal An internal refactor or improvement rust Related to Rust Polars labels Mar 9, 2024
@MarcoGorelli MarcoGorelli changed the title chore(rust!): rename ChunkedArray.try_apply to ChunkedArray.try_apply_values feat(rust!): rename ChunkedArray.try_apply to ChunkedArray.try_apply_values Mar 9, 2024
@github-actions github-actions bot added the enhancement New feature or an improvement of an existing feature label Mar 9, 2024
@MarcoGorelli MarcoGorelli marked this pull request as ready for review March 9, 2024 14:48
self.try_apply(|t| {
self.try_apply_values(|t| {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

this function looks expensive enough that it may be worth skipping null values for - with more consistent naming, this potential inefficiency jumps out a bit more

Copy link

codecov bot commented Mar 9, 2024

Codecov Report

Attention: Patch coverage is 80.00000% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 81.22%. Comparing base (e204928) to head (af68877).
Report is 4 commits behind head on main.

Files Patch % Lines
crates/polars-core/src/chunked_array/ops/apply.rs 33.33% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14947      +/-   ##
==========================================
+ Coverage   81.21%   81.22%   +0.01%     
==========================================
  Files        1348     1348              
  Lines      175318   175332      +14     
  Branches     2506     2508       +2     
==========================================
+ Hits       142390   142422      +32     
+ Misses      32448    32431      -17     
+ Partials      480      479       -1     

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

@ritchie46
Copy link
Member

Thanks, I wan to wait a bit with merging so we can still patch non-breaking rust versions.

@stinodego stinodego changed the title feat(rust!): rename ChunkedArray.try_apply to ChunkedArray.try_apply_values feat(rust!): Rename ChunkedArray.try_apply to try_apply_values Mar 21, 2024
@stinodego stinodego removed the internal An internal refactor or improvement label Mar 21, 2024
@stinodego stinodego merged commit 15e4f50 into pola-rs:main Mar 21, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking rust Change that breaks backwards compatibility for the Rust crate enhancement New feature or an improvement of an existing feature rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants