berkaysynnada commented on code in PR #14192:
URL: https://github.com/apache/datafusion/pull/14192#discussion_r1922215734
##########
datafusion/core/src/physical_optimizer/sort_pushdown.rs:
##########
@@ -103,7 +106,8 @@ fn pushdown_sorts_helper(
if !satisfy_parent {
// Make sure this `SortExec` satisfies parent requirements:
let sort_reqs =
requirements.data.ordering_requirement.unwrap_or_default();
- let fetch = requirements.data.fetch;
+ // It's possible current plan (`SortExec`) has a fetch value.
+ let fetch = requirements.data.fetch.or(sort_fetch);
Review Comment:
Even if there is not a case from the sql API, a plan can be constructed like:
```
Limit: 10
--Sort: fetch:5
```
IIUC, that will set sort fetch as 10, but that will be suboptimal. Do you
think there is something wrong in taking their min?
--
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]