jayzhan211 commented on code in PR #27532:
URL: https://github.com/apache/datafusion/pull/27532#discussion_r4729431055
##########
datafusion/physical-optimizer/src/limit_pushdown_past_window.rs:
##########
@@ -107,6 +114,12 @@ impl PhysicalOptimizerRule for LimitPushPastWindows {
return Ok(out);
}
+ // The ordering only holds further down while the nodes in between
+ // keep their input's order.
+ if node.output_ordering().is_none() {
+ ctx.ties_in_one_partition = false;
+ }
+
Review Comment:
Optional cleanup: this check can no longer change the result.
`ties_in_one_partition` is now computed from the merge's own input and every
`SortPreservingMergeExec` below recomputes it, and the only node the walk
crosses that drops the ordering, `CoalescePartitionsExec`, also leaves the
merge's input without a hash partitioning. Deleting it lets
`an_unordered_node_under_the_merge_blocks_the_pushdown` cover the non-hash
`return false` in `ties_stay_in_one_partition`: flipping that to `true` turns
it red, while at this head no test notices. With the doc comment change below,
the unit tests, the full sqllogictest suite and clippy pass.
```suggestion
```
```diff
- /// A `CoalescePartitionsExec` between the merge and the window does
not keep
- /// its input's order, so the merge's ordering says nothing below it.
+ /// A `CoalescePartitionsExec` between the merge and the window leaves
the
+ /// merge's input without a hash partitioning, so no ordering covers it.
```
--
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]