You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2025/11/17 12:58:00 UTC
[jira] [Created] (CALCITE-7294) Simplify arguments to IS [NOT] NULL whenever possible
Stamatis Zampetakis created CALCITE-7294:
--------------------------------------------
Summary: 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
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)