mertak-synnada opened a new pull request, #12003: URL: https://github.com/apache/datafusion/pull/12003
## Which issue does this PR close? - ## Rationale for this change This PR solves an issue with the subquery sortings. If a main query does not support the same sorting with the subquery and the subquery has no limit, then the ordering is redundant (unless used in an Aggregation but it's being handled in a different plan type anyway). While implementing this behavior we discovered that it's only possible to use `WITH ORDER` syntax with `EXTERNAL` tables. That's why we needed to add `LIMIT xx` conditions to subqueries so that the system can understand they're valid orderings. The sql-parser issue will be handled in a different PR to the sql-parser project and those tests will be changed back to their original forms Other than that, we discovered there are some redundant LimitExec plans even if the child plan has fetch support. Also, fixed this issue and replaced `GlobalLimitExec` plans with `skip=0` with `LocalLimitExec` plan type. Also added Limit push down support to the `UnionExec` plan type. ## What changes are included in this PR? Explained above ## Are these changes tested? Yes ## 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: 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