[
https://issues.apache.org/jira/browse/CALCITE-2469?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16583074#comment-16583074
]
Vladimir Sitnikov commented on CALCITE-2469:
--------------------------------------------
[~julianhyde], I'm sure it is the other way around.
{{SqlKind.negate}} is to simplify {{not(f(x))}} while negateNullSafe is to
simplify {{f(not(x))}}
I suggest to make the following modifications to javadoc of those methods:
{code:java}
negate:
/** Returns the kind that you get if you apply NOT to this kind.
+ * {@code NOT(IS_TRUE(x)) == IS_NOT_TRUE(x)}, so {@code IS_TRUE.negate() ==
IS_NOT_TRUE}.
+ * {@code NOT(IS_NULL(x)) == IS_NOT_NULL(x)}, so {@code IS_NULL.negate() ==
IS_NOT_NULL}.{code}
{code:java}
negateNullSafe:
- /** Returns the kind that you get if you negate this kind.
+ /** Returns the kind that you get if you negate this kind while keeping null
to be null.
* To conform to null semantics, null value should not be compared.
+ * {@code IS_TRUE(NOT(x)) == IS_FALSE(x)}, so {@code
IS_TRUE.negateNullSafe() == IS_FALSE}.
+ * {@code IS_NULL(NOT(x)) == IS_NULL(x)}, so {@code
IS_NULL.negateNullSafe() == IS_NULL}.
{code}
> RexSimplify should not optimize 'not(x) is null' to 'x is not 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 will optimize the '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)