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

chore: Remove apply_generic, use unary_elementwise #17902

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

MarcoGorelli
Copy link
Collaborator

@MarcoGorelli MarcoGorelli commented Jul 27, 2024

This is what I was talking about yesterday

It seems to me that apply_generic and unary_elementwise overlap? There's an extra little fastpath in the first one for when there's no nulls (which I ported over), but other than that, is it necessary to have both?

@MarcoGorelli MarcoGorelli changed the title chore: remove apply_generic, use unary_elementwise chore: Remove apply_generic, use unary_elementwise Jul 27, 2024
@github-actions github-actions bot added internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars and removed title needs formatting labels Jul 27, 2024
crates/polars-core/src/chunked_array/mod.rs Show resolved Hide resolved
Comment on lines 77 to 81
if ca.null_count == 0 {
let iter = ca
.downcast_iter()
.map(|arr| arr.values_iter().map(|x| op(Some(x))).collect_arr());
ChunkedArray::from_chunk_iter(ca.name(), iter)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

porting this over from apply_generic

@MarcoGorelli MarcoGorelli marked this pull request as ready for review July 27, 2024 09:44
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

Attention: Patch coverage is 89.52381% with 11 lines in your changes missing coverage. Please review.

Project coverage is 80.33%. Comparing base (82b6388) to head (2a6d253).
Report is 2 commits behind head on main.

Files Patch % Lines
.../polars-ops/src/chunked_array/strings/find_many.rs 0.00% 6 Missing ⚠️
...ates/polars-ops/src/chunked_array/strings/strip.rs 84.21% 3 Missing ⚠️
crates/polars-core/src/chunked_array/ops/apply.rs 80.00% 1 Missing ⚠️
crates/polars-time/src/chunkedarray/string/mod.rs 97.36% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #17902      +/-   ##
==========================================
- Coverage   80.35%   80.33%   -0.02%     
==========================================
  Files        1492     1492              
  Lines      196330   196301      -29     
  Branches     2813     2813              
==========================================
- Hits       157764   157705      -59     
- Misses      38045    38075      +30     
  Partials      521      521              

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

.downcast_iter()
.map(|arr| arr.iter().map(&mut op).collect_arr());
ChunkedArray::from_chunk_iter(ca.name(), iter)
if ca.null_count == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

can this use has_nulls. We want to optimize this check later.

@ritchie46 ritchie46 merged commit fae85ff into pola-rs:main Jul 30, 2024
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
internal An internal refactor or improvement python Related to Python Polars rust Related to Rust Polars
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants