alamb commented on code in PR #14221: URL: https://github.com/apache/datafusion/pull/14221#discussion_r1926008342
########## datafusion/core/src/physical_optimizer/sort_pushdown.rs: ########## @@ -107,6 +107,12 @@ fn pushdown_sorts_helper( // Make sure this `SortExec` satisfies parent requirements: let sort_reqs = requirements.data.ordering_requirement.unwrap_or_default(); // It's possible current plan (`SortExec`) has a fetch value. + // And if both of them have fetch values, we should use the minimum one. Review Comment: > It's difficult for me to construct such ut, I didn't construct a test that will go to the condition I don't think it is possible today to hit this code (as the `requirements` will contain the sort correctly) Thus I think it would be fine to merge this as is in my opinion, or perhaps you could add a check that the requirement_fetch is <= the sort_fetch if present -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org