zhuqi-lucas opened a new pull request, #27939:
URL: https://github.com/apache/datafusion/pull/27939

   ## Which issue does this PR close?
   
   - Backport of #27816 to `branch-56`, for #24463.
   
   ## Rationale for this change
   
   On 56.0.0, when `PushdownSort` removes a sort that has a fetch, the fetch 
stays right above the node below the sort. A `ProjectionExec` or 
`CooperativeExec` takes no fetch, so the limit stays above it and the source 
reads every row. A parquet scan hits this when an expression repeats and the 
projection that uses it stays above the scan. #27816 pushes the fetch down with 
`LimitPushdown`'s own logic.
   
   ## What changes are included in this PR?
   
   A cherry-pick of #27816 (`dc1245a`) with `-x`. It applied cleanly.
   
   ## What is the testing strategy for this PR?
   
   The tests from #27816 pass on this branch: the `pushdown_sort.rs` physical 
optimizer tests and `sort_pushdown.slt` with the `exact_sort_fetch_source` and 
parquet cases. The rest of the physical optimizer integration tests and 
sqllogictests pass too.
   
   ## Are there any user-facing changes?
   
   Plans can change where a sort is removed: the limit now reaches the source. 
No public API changes.
   


-- 
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]

Reply via email to