andygrove commented on code in PR #3191:
URL: https://github.com/apache/datafusion-comet/pull/3191#discussion_r2695161934
##########
native/core/src/execution/planner.rs:
##########
@@ -1604,9 +1604,22 @@ impl PhysicalPlanner {
})
.collect();
+ // Ensure input is properly sorted when ORDER BY is present
+ // BoundedWindowAggExec requires InputOrderMode::Sorted
+ let needs_explicit_sort = !sort_exprs.is_empty();
+ let sorted_child: Arc<dyn ExecutionPlan> = if
needs_explicit_sort {
+ // Insert explicit sort to ensure data ordering
+ Arc::new(SortExec::new(
+ LexOrdering::new(sort_exprs.to_vec()).unwrap(),
+ Arc::clone(&child.native_plan),
+ ))
+ } else {
+ Arc::clone(&child.native_plan)
+ };
Review Comment:
This seems to be the main fix
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]