You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by "LeonidChistov (via GitHub)" <gi...@apache.org> on 2023/04/14 10:43:36 UTC

[GitHub] [calcite] LeonidChistov commented on a diff in pull request #3143: [CALCITE-5639] eliminate IS_NOT_NULL check if LIKE expression on the same column is present

LeonidChistov commented on code in PR #3143:
URL: https://github.com/apache/calcite/pull/3143#discussion_r1166675851


##########
core/src/test/resources/sql/sub-query.iq:
##########
@@ -1748,7 +1748,7 @@ select sal from "scott".emp e
 (0 rows)
 
 !ok
-EnumerableCalc(expr#0..4=[{inputs}], expr#5=[RAND()], expr#6=[CAST($t5):INTEGER NOT NULL], expr#7=[2], expr#8=[MOD($t6, $t7)], expr#9=[3], expr#10=[=($t8, $t9)], expr#11=[IS NOT NULL($t4)], expr#12=[AND($t4, $t11)], expr#13=[OR($t10, $t12)], SAL=[$t1], $condition=[$t13])
+EnumerableCalc(expr#0..4=[{inputs}], expr#5=[RAND()], expr#6=[CAST($t5):INTEGER NOT NULL], expr#7=[2], expr#8=[MOD($t6, $t7)], expr#9=[3], expr#10=[=($t8, $t9)], expr#11=[OR($t10, $t4)], SAL=[$t1], $condition=[$t11])

Review Comment:
   Since `$t12` is defined as `expr#12=[AND($t4, $t11)]`, and we have just eliminated `expr#11=[IS NOT NULL($t4)]` as redundant (and you agree with that), there is no sense in doing `AND` anymore.
   
   So, what happens here AFAICS, is that we had condition `OR($t10, AND($t4, IS NOT NULL($t4)))` and managed to simplify it to `OR($t10, $t4)`.



-- 
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: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org