[
https://issues.apache.org/jira/browse/CALCITE-2438?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16571077#comment-16571077
]
pengzhiwei edited comment on CALCITE-2438 at 8/7/18 6:57 AM:
-------------------------------------------------------------
Hi [~julianhyde], I think the PR of [~vladimirsitnikov] is a more general
solution! And I also think we can add some more operator case to the
RexCall#isAlwaysNull,just like this:
{code:java}
@Override public boolean isAlwaysNull() {
switch (getKind()) {
.....
case EQUALS:
case GREATER_THAN:
case GREATER_THAN_OR_EQUAL:
case LESS_THAN:
case LESS_THAN_OR_EQUAL:
case NOT_EQUALS:
return operands.get(0).isAlwaysNull() || operands.get(1).isAlwaysNull();
.....
{code}
As we know that the expressions followed return unknown:
{code:java}
NULL = 1
NULL = NULL
NULL > 1
NULL >= 1
NULL < 1
NULL <= 1
NULL <> 1{code}
was (Author: pzw2018):
I think the PR of [~vladimirsitnikov] is a more general solution! And I also
think we can add some more operator case to the RexCall#isAlwaysNull,just like
this:
{code:java}
@Override public boolean isAlwaysNull() {
switch (getKind()) {
.....
case EQUALS:
case GREATER_THAN:
case GREATER_THAN_OR_EQUAL:
case LESS_THAN:
case LESS_THAN_OR_EQUAL:
case NOT_EQUALS:
return operands.get(0).isAlwaysNull() || operands.get(1).isAlwaysNull();
.....
{code}
As we know that the expressions followed return unknown:
{code:java}
NULL = 1
NULL = NULL
NULL > 1
NULL >= 1
NULL < 1
NULL <= 1
NULL <> 1{code}
> RexCall#isAlwaysTrue return incorrect result
> ---------------------------------------------
>
> Key: CALCITE-2438
> URL: https://issues.apache.org/jira/browse/CALCITE-2438
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.17.0
> Reporter: pengzhiwei
> Assignee: Julian Hyde
> Priority: Critical
> Attachments: 屏幕快照 2018-08-02 下午7.26.20.png, 屏幕快照 2018-08-02
> 下午7.34.26.png
>
>
> In the expression as followed:
> {code:java}
> ((sal IS NULL) IS NOT NULL) IS FALSE
> {code}
> The RexCall#isAlwaysTrue return true,however the correct answer is false.
> I find the reason is that there is a wrong logic in the isAlwaysTrue,when
> getKind() is IS_NOT_FALSE、IS_FALSE and IS_NOT_FALSE :
> !屏幕快照 2018-08-02 下午7.34.26.png!
> Can you have a check for me,thanks!
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)