[
https://issues.apache.org/jira/browse/CALCITE-2978?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Haisheng Yuan closed CALCITE-2978.
----------------------------------
Resolution: Invalid
Closing this issue, since this is an intended behavior.
> sorting not applied in subqueries
> ---------------------------------
>
> Key: CALCITE-2978
> URL: https://issues.apache.org/jira/browse/CALCITE-2978
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.19.0
> Reporter: Pressenna
> Assignee: Danny Chan
> Priority: Major
>
> {code:sql}
> CREATE TABLE test (id INT, val INT);
> INSERT INTO test VALUES (1,1);
> INSERT INTO test VALUES (2,2);
> INSERT INTO test VALUES (3,3);
> INSERT INTO test VALUES (4,4);
> SELECT id FROM (SELECT id, val FROM test ORDER BY val DESC);
> {code}
> Looks like CALCITE-2798 removes the sorting in sub-queries too aggressively.
> Update:
> I might be wrong here and jumped the gun too early.
> Looks like SQL does not dictate that the outer query has to retain any order
> of the inner query.
> The sort is applied if a {{LIMIT}} is specified in the inner query, to reduce
> the inner result correctly.
> Happy to close as invalid.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)