You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/06/09 14:10:40 UTC

[GitHub] [calcite] angelzouxin commented on a change in pull request #2430: [CALCITE-4619] "Full join" generates an incorrect execution plan under mysql

angelzouxin commented on a change in pull request #2430:
URL: https://github.com/apache/calcite/pull/2430#discussion_r648344681



##########
File path: core/src/test/java/org/apache/calcite/test/JdbcAdapterTest.java
##########
@@ -1045,6 +1045,29 @@ private LockWrapper exclusiveCleanDb(Connection c) throws SQLException {
         .planHasSql("SELECT \"EMPNO\", \"ENAME\"\nFROM \"SCOTT\".\"EMP\"\nWHERE \"EMPNO\" = ?");
   }
 
+  /**
+   * Test case for
+   * <a href="https://issues.apache.org/jira/browse/CALCITE-4619">[CALCITE-4619]
+   * "Full join" generates an incorrect execution plan under mysql</a>
+   */
+  @Test void testSupportedCertainJoinType() {
+    CalciteAssert.model(JdbcTest.SCOTT_MYSQL_DIALECT_MODEL)
+        .query("select empno, ename, e.deptno, dname\n"
+            + "from scott.emp e full join scott.dept d\n"
+            + "on e.deptno = d.deptno")
+        .explainContains("PLAN=EnumerableCalc(expr#0..4=[{inputs}], proj#0..2=[{exprs}], " +
+            "DNAME=[$t4])\n" +
+            "  EnumerableHashJoin(condition=[=($2, $3)], joinType=[full])\n" +
+            "    JdbcToEnumerableConverter\n" +
+            "      JdbcProject(EMPNO=[$0], ENAME=[$1], DEPTNO=[$7])\n" +
+            "        JdbcTableScan(table=[[SCOTT, EMP]])\n" +
+            "    JdbcToEnumerableConverter\n" +
+            "      JdbcProject(DEPTNO=[$0], DNAME=[$1])\n" +
+            "        JdbcTableScan(table=[[SCOTT, DEPT]])")
+        .enable(CalciteAssert.DB == CalciteAssert.DatabaseInstance.HSQLDB)
+        .runs();
+  }

Review comment:
       The dialect test in RelToSqlConverterTest does not call the optimizer. Sql.exec method only parses sql into rel and regenerates the sql string according to the configured dialect. I think the joinType test should be placed in JdbcAdapterTest, just like the dialect for supportsWindowFunctions The test case testOverNonSupportedDialect is placed like JdbcAdapterTest. WDYT?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org