suibianwanwan created CALCITE-6748:
--------------------------------------
Summary: 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
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)