ILuffZhe commented on code in PR #4117:
URL: https://github.com/apache/calcite/pull/4117#discussion_r1900487778
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -8620,14 +8620,22 @@ private void checkLiteral2(String expression, String
expected) {
* <a
href="https://issues.apache.org/jira/browse/CALCITE-6748">[CALCITE-6748]
* RelToSqlConverter returns the wrong result when Aggregate is on Sort</a>.
*/
@Test void testAggregateOnSort() {
- final String query = "select max(\"product_class_id\") "
+ final String query0 = "select max(\"product_class_id\") "
+ "from (select * from \"product\" order by \"brand_name\" asc limit
10) t";
- final String expected = "SELECT MAX(\"product_class_id\")\n"
+ final String expected0 = "SELECT MAX(\"product_class_id\")\n"
+ "FROM (SELECT \"product_class_id\"\n"
+ "FROM \"foodmart\".\"product\"\n"
+ "ORDER BY \"brand_name\"\n"
+ "FETCH NEXT 10 ROWS ONLY) AS \"t1\"";
- sql(query).ok(expected);
+ sql(query0).ok(expected0);
+
+ final String query1 = "select max(\"product_class_id\") "
+ + "from (select * from \"product\" offset 10 ) t";
+ final String expected1 = "SELECT MAX(\"product_class_id\")\n"
+ + "FROM (SELECT \"product_class_id\"\n"
+ + "FROM \"foodmart\".\"product\"\n"
+ + "OFFSET 10 ROWS) AS \"t1\"";
Review Comment:
order by expression `ORDER BY \"brand_name\"` is missing.Shall we add it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]