forked from apache/calcite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CALCITE-4323] If a view definition has an ORDER BY clause, retain th…
…e sort if the view is used in a query at top level The goal is for simple queries to retain the sorting. For example, given CREATE VIEW v AS SELECT * FROM emp WHERE job = 'CLERK' ORDER BY deptno the query SELECT * FROM v WHERE ename LIKE 'M%' will be expanded as if the user had written SELECT * FROM emp WHERE ename LIKE 'M%' AND job = 'CLERK' ORDER BY deptno But the ORDER BY will be removed from more complex queries (e.g. those involving GROUP BY, UNION, sub-query) where it would have no effect. If the ORDER BY also includes LIMIT or OFFSET, it affects the rows returned, not just their sort order; such an ORDER BY is never removed. Close apache#2679
- Loading branch information
1 parent
43ed633
commit c310f7c
Showing
3 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters