suibianwanwank commented on code in PR #4117:
URL: https://github.com/apache/calcite/pull/4117#discussion_r1900843327


##########
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:
   There is a problem with both `COUNT` and `MAX`. When there is an emp table 
in PG with 200 rows. The query `select * from emp offset 10` will returns 190 
rows.



-- 
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]

Reply via email to