vlsi commented on a change in pull request #2365:
URL: https://github.com/apache/calcite/pull/2365#discussion_r593178394
##########
File path:
core/src/test/java/org/apache/calcite/materialize/NormalizationTrimFieldTest.java
##########
@@ -106,4 +116,38 @@
final String relOptimizedStr =
RelOptUtil.toString(relOptimized.get(0).getKey());
assertThat(isLinux(optimized).matches(relOptimizedStr), is(true));
}
+
+ @Test void testJoinToJoinConditionReorder() {
+ final RelBuilder relBuilder = RelBuilder.create(config().build());
+ final RelNode query =
+ relBuilder.scan("EMP")
+ .scan("DEPT")
+ .join(JoinRelType.INNER,
+ relBuilder.call(SqlStdOperatorTable.EQUALS,
+ relBuilder.field(2, "EMP", "DEPTNO"),
+ relBuilder.field(2, "DEPT", "DEPTNO")),
+ relBuilder.call(SqlStdOperatorTable.EQUALS,
+ relBuilder.field(2, "EMP", "ENAME"),
+ relBuilder.field(2, "DEPT",
"DNAME"))).project(relBuilder.field(0)).build();
+
+ final RelNode target =
+ relBuilder.scan("EMP")
+ .scan("DEPT")
+ .join(JoinRelType.INNER,
+ relBuilder.call(SqlStdOperatorTable.EQUALS,
+ relBuilder.field(2, "EMP", "ENAME"),
+ relBuilder.field(2, "DEPT", "DNAME")),
+ relBuilder.call(SqlStdOperatorTable.EQUALS,
+ relBuilder.field(2, "EMP", "DEPTNO"),
+ relBuilder.field(2, "DEPT",
"DEPTNO"))).project(relBuilder.field(0)).build();
+
+ final RelNode replacement = relBuilder.scan("mv1").build();
+ final List<RelNode> relOptimized = new SubstitutionVisitor(target,
query).go(replacement);
+
+ final String optimized = ""
+ + "LogicalTableScan(table=[[mv1]])\n";
+ final String relOptimizedStr = RelOptUtil.toString(relOptimized.get(0));
+ assertThat(isLinux(optimized).matches(relOptimizedStr), is(true));
Review comment:
Please use `reason` message and matcher appropriately so the failure
stacktrace explains the nature of the faile
----------------------------------------------------------------
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:
[email protected]