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

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

It helps to use a truth table. For {{b = 1 OR b != 1}} it is sufficient to 
consider 3 values: null, 0, 1:

|| b || b = 1 || b != 1 || b = 1 OR b != 1
| null | unknown | unknown | unknown
| 0 | false | true | true
| 1 | true | false | true

So, {{b=1 OR b is not null}} is valid rewrite but {{b is not null}} gives the 
wrong answer when b = null.

Are you talking about the test where an expression used to simplify to 
"OR(=($7, 20), =($7, 30))" and now simplifies to "OR(=($7, 20), null, =($7, 
30))"? I agree that the null should be there. Before your change it was 
"AND(null, ...)"

> 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