gnirmal1 commented on code in PR #4552:
URL: https://github.com/apache/calcite/pull/4552#discussion_r2373931747
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -277,6 +277,55 @@ private static boolean skipItem(RexNode expr) {
.check();
}
+ private HepProgram createHypergraphProgram() {
+ return new HepProgramBuilder().addMatchOrder(HepMatchOrder.BOTTOM_UP)
+ .addRuleInstance(CoreRules.JOIN_PROJECT_RIGHT_TRANSPOSE)
+ .addRuleInstance(CoreRules.JOIN_PROJECT_LEFT_TRANSPOSE)
+ .addRuleInstance(CoreRules.PROJECT_MERGE)
+ .addRuleInstance(CoreRules.PROJECT_REMOVE)
+ .addRuleInstance(CoreRules.JOIN_TO_HYPER_GRAPH)
+ .build();
+ }
+
+ /** Test case for <a
href="https://issues.apache.org/jira/browse/CALCITE-7191">[CALCITE-7191]
+ * Hypergraph creation with incorrect hyperedges</a>. */
+ @Test void testHypergraph0() {
+ HepProgram program = createHypergraphProgram();
+ String innerJoinSql = "select a.ename, bc.name from bonus a inner join "
+ + "(select b.empno, b.ename, c.name from emp b inner join dept c on
b.deptno = c.deptno) bc "
+ + "on a.ename = bc.ename";
+
+ sql(innerJoinSql).withPre(program)
+ .withRule(CoreRules.HYPER_GRAPH_OPTIMIZE, CoreRules.PROJECT_MERGE)
+ .check();
+ }
+
Review Comment:
The same query has been duplicated for testHypergraph1 and testHypergraph2
--
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]