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

   ## Which issue does this PR close?
   
   None.
   
   ## Rationale for this change
   
   When `PushdownSort` removes a `SortExec` that has a fetch, it hands the 
fetch to the node right below the sort, or puts a limit node on top of it. A 
`ProjectionExec` takes no fetch, so the limit stays above the projection and 
the source never sees it. `PushdownSort` runs after `LimitPushdown`, so nothing 
moves it later.
   
   Parquet scans absorb projections, so plain SQL rarely hits this. Custom 
sources that keep a `ProjectionExec` above the scan do.
   
   ## What changes are included in this PR?
   
   The limit node is pushed down with `LimitPushdown`'s own logic, so it passes 
`ProjectionExec`, `CooperativeExec` and other nodes that keep the row count, 
and lands in the first node that can take it.
   
   `TestScan` keeps its partitioning when it accepts a sort, and reports itself 
as a leaf that takes a limit as its fetch.
   
   ## Are these changes tested?
   
   Yes, 7 new plan tests in `pushdown_sort.rs`.
   
   ## Are there any user-facing changes?
   
   No.
   


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