-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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 aggregation of empty groups after slice #20127
Conversation
@@ -110,6 +110,11 @@ impl PhysicalExpr for SliceExpr { | |||
.collect::<PolarsResult<Vec<_>>>() | |||
})?; | |||
let mut ac = results.pop().unwrap(); | |||
|
|||
if ac.is_aggregated() { | |||
polars_bail!(InvalidOperation: "cannot slice() an aggregated value") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by - I noticed we currently silently ignore slice()
after aggregations - I've made this raise instead.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #20127 +/- ##
==========================================
+ Coverage 79.52% 79.53% +0.01%
==========================================
Files 1563 1563
Lines 217184 217194 +10
Branches 2465 2465
==========================================
+ Hits 172706 172739 +33
+ Misses 43917 43894 -23
Partials 561 561 ☔ View full report in Codecov by Sentry. |
@@ -657,7 +657,8 @@ impl Column { | |||
let mut s = scalar_col.take_materialized_series().rechunk(); | |||
// SAFETY: We perform a compute_len afterwards. | |||
let chunks = unsafe { s.chunks_mut() }; | |||
chunks[0].with_validity(Some(validity)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this function isn't in-place and we didn't assign back 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Auch...
Returned previously filtered values instead of NULL.
Fixes #20115