[
https://issues.apache.org/jira/browse/CALCITE-6748?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17910700#comment-17910700
]
Mihai Budiu commented on CALCITE-6748:
--------------------------------------
Let's leave it like this, it's dangerous to change the main commit history.
> RelToSqlConverter returns the wrong result when Aggregate is on Sort
> --------------------------------------------------------------------
>
> Key: CALCITE-6748
> URL: https://issues.apache.org/jira/browse/CALCITE-6748
> Project: Calcite
> Issue Type: Bug
> Reporter: suibianwanwan
> Assignee: suibianwanwan
> Priority: Critical
> Labels: pull-request-available
> Fix For: 1.39.0
>
>
> Example:
> {code:java}
> @Test void testAggregateSort() {
> final String query = "select max(\"product_class_id\") "
> + "from (select * from \"product\" order by \"brand_name\" limit 10) t";
> final String expected = "SELECT MAX(\"product_class_id\")\n"
> + "FROM \"foodmart\".\"product\"\n"
> + "ORDER BY \"brand_name\"\n"
> + "FETCH NEXT 10 ROWS ONLY";
> sql(query).ok(expected);
> } {code}
> In the above example, the order of aggregation and sorting is reversed, and
> such a query will return an error in some query sources
--
This message was sent by Atlassian Jira
(v8.20.10#820010)