You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Julian Hyde (JIRA)" <ji...@apache.org> on 2018/09/20 16:52:00 UTC

[jira] [Commented] (CALCITE-2580) RexSimplify: coalesce(null > null, true) produces wrong result in unknownAsFalse mode

    [ https://issues.apache.org/jira/browse/CALCITE-2580?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16622332#comment-16622332 ] 

Julian Hyde commented on CALCITE-2580:
--------------------------------------

This is a perfect illustration of a fact that we have been ignoring: unknownAsFalse is fundamentally broken. For the result of COALESCE, we want to treat UNKNOWN the same as FALSE (because it's in a WHERE clause, say). But for the arguments of COALESCE, we want to treat UNKNOWN (or NULL) differently than FALSE.

Let's stop tinkering with small improvements found by fuzzer. Let's re-architect RexSimplify. First, {{unknownAsFalse}} needs to not be a field, it needs to be an argument. Second, we need to add an {{unknownAsTrue}} mode that behaves symmetrically.

Relevant issues are CALCITE-2338 (although frankly I'm not particularly concerned with the API, I wouldn't stick with a bad API if it means that RexSimplify is working the wrong way), CALCITE-2326, and CALCITE-2449.

[~vladimirsitnikov], Do you want to take this on?

> RexSimplify: coalesce(null > null, true) produces wrong result in unknownAsFalse mode
> -------------------------------------------------------------------------------------
>
>                 Key: CALCITE-2580
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2580
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.17.0
>            Reporter: Vladimir Sitnikov
>            Assignee: Julian Hyde
>            Priority: Major
>              Labels: newbie
>
> checkSimplify2(coalesce(gt(nullInt, nullInt), trueLiteral), "true", "true");
> {noformat}
> java.lang.AssertionError: result mismatch:
> when applied to {}, COALESCE(>(null, null), true) yielded true, and false yielded false
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)