xuzifu666 commented on code in PR #5101:
URL: https://github.com/apache/calcite/pull/5101#discussion_r3592000945
##########
core/src/test/java/org/apache/calcite/rel/rel2sql/RelToSqlConverterTest.java:
##########
@@ -2016,6 +2016,40 @@ private static String toSql(RelNode root, SqlDialect
dialect,
relFn(relFn).withOracle().ok(expectedOracle);
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-7655">[CALCITE-7655]
+ * RelToSqlConverter incorrectly removes a subquery when grouping by a
window function
+ * result</a>. */
+ @Test void testGroupByWindowFunction() {
+ final String query = "SELECT \"EMPNO\", \"row_number\", COUNT(*) AS
\"c\"\n"
+ + "FROM (\n"
+ + " SELECT \"EMPNO\",\n"
+ + " ROW_NUMBER() OVER (ORDER BY \"EMPNO\" NULLS FIRST) AS
\"row_number\"\n"
+ + " FROM \"EMP\") AS \"t\"\n"
+ + "GROUP BY \"EMPNO\", \"row_number\"";
+
+ final String expectedMysql = "SELECT `EMPNO`, `row_number`, COUNT(*) AS
`c`\n"
Review Comment:
I assume you've also verified these tests against the corresponding
databases.
--
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]