[
https://issues.apache.org/jira/browse/CALCITE-4160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17188261#comment-17188261
]
Stamatis Zampetakis commented on CALCITE-4160:
----------------------------------------------
The SQL standard classifies the following in the list of optional features:
|F850| Top-level <order by clause> in <query expression>|
|F851| <order by clause> in subqueries|
|F852| Top-level <order by clause> in views|
|F855| Nested <order by clause> in <query expression>|
That is to say that ORDER BY in subqueries is something covered by the SQL
standard. Moreover it is worth noting that even top-level ORDER BY
expressions belong to the list of optional features.
Below some relevant extracts from the SQL standard:
Without Feature F850, “Top-level <order by clause>in <query expression>”, in
conforming SQL language,
a <query expression> not immediately contained in either an <array value
constructor by query> or a
<cursor specification> shall not immediately contain an <order by clause>.
Without Feature F851, “<order by clause>in subqueries”, in conforming SQL
language, a <query expression>
contained in another <query expression> shall not immediately contain an <order
by clause>.
Without Feature F852, “Top-level <order by clause>in views”, in conforming SQL
language, a <query
expression> immediately contained in a <view definition> shall not immediately
contain an <order by
clause>.
Without Feature F855, “Nested <order by clause>in <query expression>”, in
conforming SQL language,
a <query primary> shall not immediately contain an <order by clause>.
> Add configuration to retain ORDER BY in sub-query
> -------------------------------------------------
>
> Key: CALCITE-4160
> URL: https://issues.apache.org/jira/browse/CALCITE-4160
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Jiatao Tao
> Assignee: Jiatao Tao
> Priority: Minor
> Labels: pull-request-available
> Attachments: image-2020-08-07-10-48-59-599.png,
> image-2020-08-07-10-50-22-351.png
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> Pre discussion see in
> https://issues.apache.org/jira/browse/CALCITE-2798
> https://issues.apache.org/jira/browse/CALCITE-3664
> IMO, we should at least provide a configuration about this. People use
> Calcite most for its optimizer, and this info users may care, How it executed
> is by the engine, but users should know this in the plan.
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)