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: Incorrect comparison in some cases with filtered list/array columns #20243

Merged
merged 1 commit into from
Dec 10, 2024

Conversation

nameexhaustion
Copy link
Collaborator

Fixes #20165

@github-actions github-actions bot added fix Bug fix python Related to Python Polars rust Related to Rust Polars labels Dec 10, 2024
let right = rhs.chunks()[0]
let right = rhs
.downcast_iter()
.find(|x| !x.is_empty())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

empty chunks 🥲

Copy link
Member

Choose a reason for hiding this comment

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

Ai, how do we get those?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The filter goes through a the binary_unchecked_same_type kernel, which takes the filter op as Fn(Array, Array) -> Array - so if the predicate was false for an entire chunk it ends up empty

let chunks = lhs
.downcast_iter()
.zip(rhs.downcast_iter())
.map(|(lhs_arr, rhs_arr)| op(lhs_arr, rhs_arr))
.collect();
let mut ca = lhs.copy_with_chunks(chunks);

Copy link

codecov bot commented Dec 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 79.64%. Comparing base (2c76494) to head (fe2ff13).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #20243      +/-   ##
==========================================
- Coverage   79.65%   79.64%   -0.01%     
==========================================
  Files        1565     1565              
  Lines      218202   218213      +11     
  Branches     2475     2475              
==========================================
- Hits       173804   173798       -6     
- Misses      43831    43848      +17     
  Partials      567      567              

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

@nameexhaustion nameexhaustion marked this pull request as ready for review December 10, 2024 08:12
@ritchie46 ritchie46 merged commit 8c39bb9 into pola-rs:main Dec 10, 2024
26 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.

Comparison for Array and List with masked out values is wrong when broadcasting
2 participants