[
https://issues.apache.org/jira/browse/CALCITE-7294?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18039084#comment-18039084
]
Stamatis Zampetakis commented on CALCITE-7294:
----------------------------------------------
cc [~thomas.rebele]
> Simplify arguments to IS [NOT] NULL whenever possible
> -----------------------------------------------------
>
> Key: CALCITE-7294
> URL: https://issues.apache.org/jira/browse/CALCITE-7294
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Stamatis Zampetakis
> Priority: Major
>
> Currently there are few cases where {{RexSimplify}} bails out when attempting
> to simplify an IS NULL/IS NOT NULL expression:
> *
> [https://github.com/apache/calcite/blob/31a23f38092c185ef0faf19f770c1de8625db0e8/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L1159]
> *
> [https://github.com/apache/calcite/blob/31a23f38092c185ef0faf19f770c1de8625db0e8/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L1190]
> It seems possible though to simplify the arguments and retain the IS NULL/IS
> NOT NULL expression.
> {+}Example{+}:
> Currently {{COALESCE(age + 0, year) IS NULL}} cannot be simplified and is
> returned as is. However, we could simplify the expression to {{COALESCE(age,
> year) IS NULL}}.
> This improvement mainly affects IS NULL and IS NOT NULL simplification when
> the argument is an function/operator with:
> * [custom
> nullability|https://github.com/apache/calcite/blob/31a23f38092c185ef0faf19f770c1de8625db0e8/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L1280]
> (i.e., CAST, ITEM)
> * {{Strong.Policy}} other than {{ANY}} and {{NOT_NULL}}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)