[
https://issues.apache.org/jira/browse/IGNITE-27395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18049082#comment-18049082
]
Maksim Zhuravkov edited comment on IGNITE-27395 at 1/5/26 7:26 AM:
-------------------------------------------------------------------
This expression is simplified in calcite 1.40 because Strong.isNull(call (NULL
+ ? )) returns true, so the call can be converted to NULL.
In 1.41 RexSimplify was updated to call RexSimplfy.isSafeExpression that
returns false for when a call contains a dynamic parameter argument. A branch
{noformat}
if (Strong.isNull(call))) { ... } // 1.40
{noformat}
Became
{noformat}
if (isSafeExpression(call) && Strong.isNull(call)) { ... } // 1.41
{noformat}
So NULL + ? is never simplified.
was (Author: JIRAUSER298618):
This expression is simplified in calcite 1.40 because Strong.isNull(call (NULL
+ ? )) returns true, so the call can be converted to NULL.
In 1.41 RexSimplify was updated to call RexSimplfy.isSafeExpression that
returns false for when a call contains a dynamic parameter argument. A branch
```
if (Strong.isNull(call))) { ... } // 1.40
```
Became
```
if (isSafeExpression(call) && Strong.isNull(call)) { ... } // 1.41
```
So NULL + ? is never simplified.
> Sql. Expressions with dynamic parameters and NULL (e.g. NULL + ?int) are not
> simplified to NULL after calcite 1.41
> ------------------------------------------------------------------------------------------------------------------
>
> Key: IGNITE-27395
> URL: https://issues.apache.org/jira/browse/IGNITE-27395
> Project: Ignite
> Issue Type: Improvement
> Components: sql ai3
> Reporter: Maksim Zhuravkov
> Assignee: Maksim Zhuravkov
> Priority: Major
> Labels: ignite-3
> Fix For: 3.2
>
> Time Spent: 10m
> Remaining Estimate: 0h
>
> Calcite 1.41 made some changes related to expression simplification.
> For example (NULL + ?int) expression, that is successfully simplified in
> calcite 1.40, is no longer simplified to NULL, because this code no calls
> isSafeExpression(e) that is false for (NULL + ?int) so the branch with
> simplification code is not taken.
> {noformat} Calcite 1.41
> RexNode simplify(RexNode e, RexUnknownAs unknownAs) {
> if (isSafeExpression(e) && STRONG.isNull(e)) {
> ...
> }
> }
> {noformat}
> In calcite 1.40 `isSafeExpression(e)` is also returns `false`, but
> `simplify` does not perform `isSafeExpression(e)` check.
> Calcite issue that introduced that change
> https://issues.apache.org/jira/browse/CALCITE-7032
--
This message was sent by Atlassian Jira
(v8.20.10#820010)