LakeShen commented on code in PR #3396:
URL: https://github.com/apache/calcite/pull/3396#discussion_r1335153441


##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -1254,6 +1254,30 @@ private void 
checkSemiOrAntiJoinProjectTranspose(JoinRelType type) {
     diffRepos.assertEquals("planAfter", "${planAfter}", planAfter);
   }
 
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-5940";>[CALCITE-5940]
+   * Add the Rules to optimize Limit</a>. */
+  @Test void testLimitMerge() {
+    final String sql = "select deptno from "
+        + "(select deptno from emp where sal > 100 limit 10000) limit 10";
+    sql(sql)
+        .withPreRule(CoreRules.SORT_PROJECT_TRANSPOSE)
+        .withRule(CoreRules.LIMIT_MREGE, CoreRules.PROJECT_REMOVE)
+        .check();
+  }
+
+  /** Test case for
+   * <a 
href="https://issues.apache.org/jira/browse/CALCITE-5940";>[CALCITE-5940]
+   * Add the Rules to optimize Limit</a>. */
+  @Test void testLimitMerge1() {

Review Comment:
   > +1,
   > 
   > We need `checkUnchanged` for offset.
   
   Yes,it make sense for me , I will add this test case.



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