[
https://issues.apache.org/jira/browse/CALCITE-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16598134#comment-16598134
]
pengzhiwei edited comment on CALCITE-2469 at 8/31/18 2:36 AM:
--------------------------------------------------------------
Hi [~julianhyde],I find same problem in the "improvement for strong functions".
{code:java}
546 + if (simplified == null) {
547 + operands.add(
548+ rexBuilder.makeCall(SqlStdOperatorTable.IS_NULL, operand));
549+ } else if (simplified.isAlwaysFalse()) {
550+ return rexBuilder.makeLiteral(false);
551+ } else {
{code}
In line 549,I think we should use "simplified.isAlwaysTrue()" here as any of
the operand is null then this RexNode is null.And the return should be "true"
in line 550.
{code:java}
555 + return RexUtil.composeConjunction(rexBuilder, operands, false);
556 + case AS_IS:
{code}
In line 555,Also should we use RexUtil.composeDisjunction() here? For example,
"(a+b) is null" equals "a is null or b is null",but not "a is null and b is
null".
was (Author: pzw2018):
Hi [~julianhyde],I find same problem in the "improvement for strong functions".
{code:java}
546 + if (simplified == null) {
547 + operands.add(
548+ rexBuilder.makeCall(SqlStdOperatorTable.IS_NULL, operand));
549+ } else if (simplified.isAlwaysFalse()) {
550+ return rexBuilder.makeLiteral(false);
551+ } else {
{code}
In line 549,I think we should use "simplified.isAlwaysTrue()" here as any of
the operand is null then this RexNode is null.And the return should be "true".
{code:java}
555 + return RexUtil.composeConjunction(rexBuilder, operands, false);
556 + case AS_IS:
{code}
In line 555,Also should we use RexUtil.composeDisjunction() here? For example,
"(a+b) is null" equals "a is null or b is null",but not "a is null and b is
null".
> RexSimplify should optimize '(NOT x) IS NULL' to 'x IS NULL'
> ------------------------------------------------------------
>
> Key: CALCITE-2469
> URL: https://issues.apache.org/jira/browse/CALCITE-2469
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: pengzhiwei
> Assignee: Julian Hyde
> Priority: Critical
>
> The RexSimplify currently optimizes '(not x) is null' to 'x is not null'.
> However, this is incorrect. It is same to the case '(not x) is not null'.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)