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: count of null column shouldn't panic in agg context #15710

Merged
merged 1 commit into from
Apr 17, 2024

Conversation

reswqa
Copy link
Collaborator

@reswqa reswqa commented Apr 17, 2024

Fixes #15705.

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Apr 17, 2024
count
})
.collect_ca_trusted_with_dtype(&keep_name, IDX_DTYPE);
let out: IdxCa = if matches!(s.dtype(), &DataType::Null) {
Copy link
Collaborator Author

@reswqa reswqa Apr 17, 2024

Choose a reason for hiding this comment

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

NullArray is sort of not a good kid. It doesn't follow the invariant that validity = None => null count = 0. Instead, all of its elements are null, whereas validity is always None. I'm not sure if we want to add a validity field with all zeros to it.

But anyway, this change/fix can always be viewed as a fast path.

Copy link
Member

Choose a reason for hiding this comment

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

We can put this fast path immediately on L173. Then we don't have to duplicate the branch.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh, didn't realize we had group.len(). Updated.

Copy link

codspeed-hq bot commented Apr 17, 2024

CodSpeed Performance Report

Merging #15710 will improve performances by 10.39%

Comparing reswqa:null_count_gb (79a86f1) with main (e39ba62)

Summary

⚡ 1 improvements
✅ 21 untouched benchmarks

Benchmarks breakdown

Benchmark main reswqa:null_count_gb Change
test_boolean_min_max_agg 17.1 ms 15.5 ms +10.39%

Copy link

codecov bot commented Apr 17, 2024

Codecov Report

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

Project coverage is 81.34%. Comparing base (70b71da) to head (31f35f0).
Report is 19 commits behind head on main.

❗ Current head 31f35f0 differs from pull request most recent head 79a86f1. Consider uploading reports for the commit 79a86f1 to get more accurate results

Files Patch % Lines
...-lazy/src/physical_plan/expressions/aggregation.rs 50.00% 16 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##             main   #15710    +/-   ##
========================================
  Coverage   81.33%   81.34%            
========================================
  Files        1374     1375     +1     
  Lines      176471   176572   +101     
  Branches     2544     2544            
========================================
+ Hits       143539   143635    +96     
- Misses      32450    32453     +3     
- Partials      482      484     +2     

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

@reswqa reswqa marked this pull request as ready for review April 17, 2024 06:35
@ritchie46 ritchie46 merged commit 2db0ba6 into pola-rs:main Apr 17, 2024
24 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.

PanicException raised when trying to count columns containing null in a groupby
2 participants