zabetak commented on code in PR #3170:
URL: https://github.com/apache/calcite/pull/3170#discussion_r1193838011
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -3646,6 +3649,104 @@ private void checkRightEmptyAntiJoin(JoinRelType type) {
checkEmptyJoin(relFn(relFn));
}
+ @Test void testCorrelateWithoutCorrelationToEmpty() {
+ String sql = "select * from emp e where exists (select 1 from dept where
empno=null)";
+ List<RelOptRule> rules =
+ Arrays.asList(CoreRules.FILTER_REDUCE_EXPRESSIONS,
+ PruneEmptyRules.PROJECT_INSTANCE,
+ PruneEmptyRules.AGGREGATE_INSTANCE,
+ PruneEmptyRules.JOIN_RIGHT_INSTANCE,
+ CoreRules.CORRELATE_TO_JOIN_RULE);
+ sql(sql)
+ .withExpand(false)
+ .withPreRule(CoreRules.FILTER_SUB_QUERY_TO_CORRELATE)
+ .withProgram(HepProgram.builder().addRuleCollection(rules).build())
+ .check();
+ }
+
+ @Test void testInnerCorrelateWithoutCorrelationToJoin() {
+ relFn(correlationPlanBuilder(JoinRelType.INNER, false))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .check();
+ }
+
+ @Test void testSemiCorrelateWithoutCorrelationToJoin() {
+ relFn(correlationPlanBuilder(JoinRelType.SEMI, false))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .check();
+ }
+
+ @Test void testAntiCorrelateWithoutCorrelationToJoin() {
+ relFn(correlationPlanBuilder(JoinRelType.ANTI, false))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .check();
+ }
+
+ @Test void testLeftCorrelateWithoutCorrelationToJoin() {
+ relFn(correlationPlanBuilder(JoinRelType.LEFT, false))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .check();
+ }
+
+ @Test void testInnerCorrelateWithCorrelationUnchanged() {
+ relFn(correlationPlanBuilder(JoinRelType.INNER, true))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .checkUnchanged();
+ }
+
+ @Test void testLeftCorrelateWithCorrelationUnchanged() {
+ relFn(correlationPlanBuilder(JoinRelType.LEFT, true))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .checkUnchanged();
+ }
+
+ @Test void testSemiCorrelateWithCorrelationUnchanged() {
+ relFn(correlationPlanBuilder(JoinRelType.SEMI, true))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .checkUnchanged();
+ }
+
+ @Test void testAntiCorrelateWithCorrelationUnchanged() {
+ relFn(correlationPlanBuilder(JoinRelType.ANTI, true))
+ .withRule(CoreRules.CORRELATE_TO_JOIN_RULE)
+ .checkUnchanged();
+ }
+
+ /**
+ * Provides a function that will create a simple plan correlating EMP and
DEPT tables with the
+ * provided join type.
Review Comment:
Method doesn't exist in latest patch.
--
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]