-
-
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: Fix incorrect lazy schema for explode()
in agg()
#19623
Conversation
@@ -170,7 +170,7 @@ impl ApplyExpr { | |||
// })? | |||
let out: ListChunked = POOL.install(|| iter.collect::<PolarsResult<_>>())?; | |||
|
|||
debug_assert_eq!(out.dtype(), &DataType::List(Box::new(dtype))); | |||
debug_assert_eq!(&dtype, out.dtype()); |
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.
I think the output field of the expression should created in an aggregation-context-aware manner, so I've updated this assertion.
@@ -239,7 +239,7 @@ fn create_physical_expr_inner( | |||
// TODO! Order by | |||
let group_by = create_physical_expressions_from_nodes( | |||
partition_by, | |||
Context::Default, | |||
Context::Aggregation, |
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 is under AExpr::Window
@@ -72,7 +72,6 @@ impl AExpr { | |||
}, | |||
Explode(expr) => { | |||
let field = arena.get(*expr).to_field_impl(schema, arena, nested)?; | |||
*nested = nested.saturating_sub(1); |
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.
Fix for the linked issue explode()
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #19623 +/- ##
==========================================
- Coverage 79.92% 79.92% -0.01%
==========================================
Files 1536 1536
Lines 211686 211695 +9
Branches 2445 2445
==========================================
+ Hits 169192 169197 +5
- Misses 41939 41943 +4
Partials 555 555 ☔ View full report in Codecov by Sentry. |
expr_arena | ||
.get(expression) | ||
.to_field(schema, Context::Default, expr_arena)?; | ||
if let Context::Aggregation = ctxt { |
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.
I think we should just pass the context to line 497 instead of updating the dtype here.
expr_arena | ||
.get(expression) | ||
.to_field(schema, Context::Default, expr_arena)?; | ||
if let Context::Aggregation = ctxt { |
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.
idem
99046fb
to
6c883d0
Compare
I think I have this figured out, will close in favor of #19629 |
Fixes #19562nvm, I have a better fix in newer PR. This one is more of a hack