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

Julian Hyde commented on CALCITE-2247:
--------------------------------------

CALCITE-2314 does not affect the behavior of RexSimplify (or any code in main). 
It only affects testing. It finds things that existing tests missed. (Or in 
this case, finds tests that are wrongly passing, because the desired 
simplification is logically invalid.)

The bug is not "x and not x" (which, as we agreed earlier, probably already 
existed).

The bug is that RexSimplifier, in unknownAsFalse mode only, simplifies {{b <> 1 
or b = 1}} to true. This erroneous behavior was introduced by your change.

I played my part when I mistakenly added the following test:{code}    // "b != 
1 or b = 1" ==> "true" (valid because we have unknownAsFalse)
    final RexNode neOrEq = or(
        ne(bRef, literal1),
        eq(bRef, literal1));
    checkSimplifyFilter(neOrEq, "true");
{code}

That test is wrong. It is not valid to simplify "b <> 1 or b = 1" to "true", 
regardless of whether unknownAsFalse is true or false.

> Add rule to push in condition condition into a related disjunctive expression
> -----------------------------------------------------------------------------
>
>                 Key: CALCITE-2247
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2247
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>
> Simplify expressions like: {code}a = 1 AND (a = 1 OR a = 2){code} to {code}a 
> = 1{code}
> Conditions to apply will be:
> * in an AND condition there exists a comparison(c) and an OR (o)
> * o and c only reference 1 variable
> See HIVE-19097 for more info.



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

Reply via email to