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: Fix filter scalar nulls #19786

Merged
merged 3 commits into from
Nov 15, 2024
Merged

fix: Fix filter scalar nulls #19786

merged 3 commits into from
Nov 15, 2024

Conversation

ritchie46
Copy link
Member

fixes #19771

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Nov 14, 2024
@@ -280,6 +280,11 @@ impl SeriesTrait for NullChunked {
// We still allow a length of `1` because it could be `lit(true)`.
polars_ensure!(filter.len() <= 1, ShapeMismatch: "filter's length: {} differs from that of the series: 0", filter.len());
0
} else if filter.len() == 1 {
return match filter.get(0) {
None | Some(true) => Ok(self.clone().into_series()),
Copy link
Collaborator

Choose a reason for hiding this comment

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

I believe that None should be in the false branch, not behave like true.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeap, good catch.

@ritchie46 ritchie46 merged commit 9df0b79 into main Nov 15, 2024
23 checks passed
@ritchie46 ritchie46 deleted the filter branch November 15, 2024 15:06
Copy link

codecov bot commented Nov 15, 2024

Codecov Report

Attention: Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.

Project coverage is 79.54%. Comparing base (420c0d9) to head (4a24c84).
Report is 15 commits behind head on main.

Files with missing lines Patch % Lines
...tes/polars-core/src/series/implementations/null.rs 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19786      +/-   ##
==========================================
- Coverage   79.55%   79.54%   -0.02%     
==========================================
  Files        1544     1546       +2     
  Lines      213240   213511     +271     
  Branches     2441     2444       +3     
==========================================
+ Hits       169645   169829     +184     
- Misses      43046    43132      +86     
- Partials      549      550       +1     

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

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.

A no-op filter errors when the dataframe has an all null column
2 participants