juntaozhang commented on code in PR #4338:
URL: https://github.com/apache/calcite/pull/4338#discussion_r2062586993


##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -7962,6 +7963,50 @@ private void checkSemiJoinRuleOnAntiJoin(RelOptRule 
rule) {
         .checkUnchanged();
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-6983";>[CALCITE-6983]
+   * SortJoinTransposeRule should not push SORT past a UNION when SORT's fetch 
is DynamicParam
+   </a>. */
+  @Test void testSortJoinTranspose8() {
+    HepProgramBuilder builder = new HepProgramBuilder();
+    builder.addRuleClass(SortProjectTransposeRule.class);
+    builder.addRuleClass(SortJoinTransposeRule.class);
+    builder.addRuleClass(SortUnionTransposeRule.class);
+    HepPlanner hepPlanner = new HepPlanner(builder.build());
+    hepPlanner.addRule(CoreRules.SORT_PROJECT_TRANSPOSE);
+    hepPlanner.addRule(CoreRules.SORT_JOIN_TRANSPOSE);
+    hepPlanner.addRule(CoreRules.SORT_UNION_TRANSPOSE);
+    final String sql = "SELECT x.empno1, y.empno2\n"
+        + " FROM (\n"
+        + "  SELECT empno as empno1 from emp where empno = ?\n"
+        + "  UNION ALL\n"
+        + "  SELECT empno as empno1 from emp where job = ?\n"
+        + " ) AS x\n"
+        + " left join (\n"
+        + "  SELECT empno as empno2 from emp where mgr = ?\n"
+        + " ) AS y on x.empno1 = y.empno2\n"
+        + " FETCH NEXT ? ROWS ONLY";
+    sql(sql).withPlanner(hepPlanner).check();
+  }
+
+  @Test void testSortJoinTranspose9() {

Review Comment:
   Done, thanks for your reminding.



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