alex-plekhanov commented on code in PR #2631:
URL: https://github.com/apache/calcite/pull/2631#discussion_r2153056928
##########
core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java:
##########
@@ -286,6 +286,57 @@ public static void checkActualAndReferenceFiles() {
sql(sql).ok();
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-4915">[CALCITE-4915]
+ * Query with unqualified common column and NATURAL JOIN fails</a>. */
+ @Test void testJoinNaturalWithUnqualifiedCommonColumn() {
+ final String sql = "SELECT deptno, name\n"
+ + "FROM emp\n"
+ + "NATURAL JOIN dept";
+ sql(sql).ok();
+ }
+
+ /** Similar to {@link #testJoinNaturalWithUnqualifiedCommonColumn()},
+ * but with nested common column. */
+ @Test void testJoinNaturalWithUnqualifiedNestedCommonColumn() {
+ final String sql =
+ "select (coord).x\n"
+ + "from customer.contact_peek t1\n"
+ + "natural join customer.contact_peek t2";
+ sql(sql).ok();
+ }
+
+ /** Similar to {@link #testJoinNaturalWithUnqualifiedCommonColumn()},
+ * but with aggregate. */
+ @Test void testJoinNaturalWithAggregate() {
+ final String sql = "select deptno, count(*)\n"
+ + "from emp\n"
+ + "natural join dept\n"
+ + "group by deptno";
+ sql(sql).ok();
+ }
+
+ /** Similar to {@link #testJoinNaturalWithUnqualifiedCommonColumn()},
+ * but with grouping sets. */
+ @Test void testJoinNaturalWithGroupingSets() {
+ final String sql = "select deptno, grouping(deptno),\n"
+ + "grouping(deptno, job), count(*)\n"
+ + "from emp\n"
+ + "natural join dept\n"
+ + "group by grouping sets ((deptno), (deptno, job))";
+ sql(sql).ok();
+ }
+
+ /** Similar to {@link #testJoinNaturalWithUnqualifiedCommonColumn()},
+ * but with multiple join. */
+ @Test void testJoinNaturalWithMultipleJoin() {
Review Comment:
@mihaibudiu plan have changed a little bit, additional cast added (from CHAR
to VARCHAR). Related change https://issues.apache.org/jira/browse/CALCITE-6413
I've fixed the test to match the current plan, but perhaps it's an issue and
we shouldn't cast CHAR types to VARCHAR
--
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]