liuyongvs commented on code in PR #25932:
URL: https://github.com/apache/flink/pull/25932#discussion_r2191354127


##########
flink-table/flink-table-planner/src/test/scala/org/apache/flink/table/planner/plan/rules/logical/JoinRemoveRulesTest.scala:
##########
@@ -0,0 +1,311 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.flink.table.planner.plan.rules.logical
+
+import org.apache.flink.table.api._
+import 
org.apache.flink.table.planner.plan.optimize.program.{BatchOptimizeContext, 
FlinkChainedProgram, FlinkHepRuleSetProgramBuilder, HEP_RULES_EXECUTION_TYPE}
+import org.apache.flink.table.planner.utils.TableTestBase
+
+import org.apache.calcite.plan.hep.HepMatchOrder
+import org.apache.calcite.rel.rules._
+import org.apache.calcite.tools.RuleSets
+import org.junit.jupiter.api.{BeforeEach, Test}
+
+import java.sql.Timestamp
+
+/**
+ * Tests for [[ProjectJoinJoinRemoveRule]], [[ProjectJoinRemoveRule]],
+ * [[AggregateJoinJoinRemoveRule]], [[AggregateJoinRemoveRule]].
+ */
+class JoinRemoveRulesTest extends TableTestBase {
+
+  private val util = batchTestUtil()
+
+  @BeforeEach
+  def setup(): Unit = {
+    val programs = new FlinkChainedProgram[BatchOptimizeContext]()
+    programs.addLast(
+      "rules",
+      FlinkHepRuleSetProgramBuilder.newBuilder
+        .setHepRulesExecutionType(HEP_RULES_EXECUTION_TYPE.RULE_SEQUENCE)
+        .setHepMatchOrder(HepMatchOrder.BOTTOM_UP)
+        .add(RuleSets.ofList(
+          CoreRules.AGGREGATE_PROJECT_MERGE,
+          CoreRules.PROJECT_JOIN_JOIN_REMOVE,
+          CoreRules.PROJECT_JOIN_REMOVE,
+          CoreRules.AGGREGATE_JOIN_JOIN_REMOVE,
+          CoreRules.AGGREGATE_JOIN_REMOVE
+        ))
+        .build()
+    )
+    util.replaceBatchProgram(programs)
+
+    util.addTableSource[(Int, String, String, Int, Timestamp, Int, Int, Int, 
Boolean)](
+      "emp",
+      'empno,
+      'ename,
+      'job,
+      'mgr,
+      'hiredate,
+      'sal,
+      'comm,
+      'deptno,
+      'slacker)
+    util.addTableSource[(Int, String)]("dept", 'deptno, 'name)
+  }
+
+  @Test
+  def testAggregateJoinRemoveRule1(): Unit = {
+    val sqlQuery =
+      s"""
+         |select count(distinct sal) from emp e
+         |left outer join dept d1 on e.job = d1.name
+         |left outer join dept d2 on e.job = d2.name
+         |group by e.job
+       """.stripMargin
+    util.verifyRelPlan(sqlQuery)
+  }
+
+  @Test
+  def testAggregateJoinRemoveRule2(): Unit = {

Review Comment:
   copy from 
https://github.com/apache/calcite/pull/1160/files#diff-bc6d90f2392477eb02e40d8bc26ad2d8b0d6bd6dd2714ea0c2b94b3043ff9a8e
 , the calcite plan has testAggregateJoinRemoveRule1 and 
testAggregateJoinRemoveRule2, while the test doesn't have. so i remove these 
two test too



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