You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2018/08/28 11:01:00 UTC

[jira] [Commented] (CALCITE-2327) In 3 valued logic mode (b and not b) may not be simplified to false

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

Zoltan Haindrich commented on CALCITE-2327:
-------------------------------------------

[~vladimirsitnikov]: You have submitted a completely different patch than in the PR linked to this ticket.
Unfortunately the patch you submitted still suffer from oversimplification.

Adding the following testcase to RexProgramTest results in an assertionError; because verify will fail:
java.lang.AssertionError: result mismatch: when applied to {?0.a=NULL, ?0.b=true}, AND(?0.a, NOT(?0.a), ?0.b, NOT(?0.b)) yielded false, and AND(null, IS NULL(?0.a)) yielded 

{code}
  @Test
  public void testSimplifyAnd4() {
    final RelDataType boolType = typeFactory.createSqlType(SqlTypeName.BOOLEAN);
    final RelDataType rowType = typeFactory.builder()
        .add("a", boolType).nullable(true)
        .add("b", boolType).nullable(true)
        .build();

    final RexDynamicParam range = rexBuilder.makeDynamicParam(rowType, 0);
    final RexNode aRef = rexBuilder.makeFieldAccess(range, 0);
    final RexNode bRef = rexBuilder.makeFieldAccess(range, 1);

    // in the case of 3-valued logic, the result must be unknown if a is unknown
    checkSimplify2(
        and(aRef,
            not(aRef),
            bRef,
            not(bRef)),
        "...",
        "false");
  }
{code}

I would have been happy if you would communicate with me about this patch instead of just commiting your own idea about it...

> In 3 valued logic mode (b and not b) may not be simplified to false
> -------------------------------------------------------------------
>
>                 Key: CALCITE-2327
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2327
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>             Fix For: 1.18.0
>
>
> currently its simplified to false; but that is not correct when a is unknown



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