julianhyde commented on code in PR #2800:
URL: https://github.com/apache/calcite/pull/2800#discussion_r869501824
##########
core/src/test/java/org/apache/calcite/test/RelOptRulesTest.java:
##########
@@ -411,6 +411,37 @@ private static boolean skipItem(RexNode expr) {
sql(sql).withRule(CoreRules.JOIN_ADD_REDUNDANT_SEMI_JOIN).check();
}
+ /** Test case for
+ * <a
href="https://issues.apache.org/jira/browse/CALCITE-3890">[CALCITE-3890]
+ * Derive IS NOT NULL filter from inner join</a>. */
+ @Test void testJoinDeriveIsNotNullFilterRule1() {
+ final String sql = "select t1.deptno from emp t1 inner join emp t2 on
t1.mgr = t2.mgr";
+ sql(sql).withRule(CoreRules.JOIN_DERIVE_IS_NOT_NULL_FILTER_RULE).check();
+ }
+
+ /** As {@link #testJoinDeriveIsNotNullFilterRule1()};
+ * should create is not null filter in the right input of join. */
+ @Test void testJoinDeriveIsNotNullFilterRule2() {
+ final String sql = "select t1.deptno from (select * from emp where mgr is
not null) t1 "
+ + "join emp t2 on t1.mgr = t2.mgr";
+ sql(sql).withRule(CoreRules.JOIN_DERIVE_IS_NOT_NULL_FILTER_RULE).check();
+ }
+
+ /** As {@link #testJoinDeriveIsNotNullFilterRule1()};
+ * should not create is not null filter in both sides since it is full join.
*/
+ @Test void testJoinDeriveIsNotNullFilterRule3() {
Review Comment:
Capitalize SQL keywords. "create is not null filter" is ungrammatical, but
"create IS NOT NULL filter" makes sense.
--
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]