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

Zoltan Haindrich commented on CALCITE-3192:
-------------------------------------------

I see now; so you are after whether that issue would be fixed by this patch;
what happens without this patch is that: 
{code}
(1<a) or (a<3 and (b=2))
-- for which the following rewrite is valid:
(a>1) or (a<3 and a<=1 and b=2)
-- but...because of implementation details...the a<=1 is introduced as a 
predicate; which could be described like:
(a>1) or ( a<3 and b=2 | when a<=1)
-- which is rewritten to (because a<=1 was a predicate)
(a>1) or (b=2)  
{code}
...in then end it will answer the a=null case incorrectly as you have described

I hope this helps clean up things

> Simplification may weaken OR conditions containing inequalities
> ---------------------------------------------------------------
>
>                 Key: CALCITE-3192
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3192
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Jess Balint
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.21.0
>
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> RexSimplify is transforming
> * {{OR(AND(>(999, $8), =($2, 'Franklin')), <(100, $8))}}
> * to {{OR(=($2, 'Franklin'), <(100, $8))}}
> the predicates are accumulated in {{simplifyOrTerms()}} but not discarded 
> when iterating the second time



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to