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

Zoltan Haindrich edited comment on CALCITE-3192 at 7/25/19 3:25 PM:
--------------------------------------------------------------------

[~jbal...@gmail.com] throwing away the predicates might save this case; but may 
probably not fix all cases; and the usage of this predicates is usefull; could 
help further symplify cases - so I try to save it :)

I've further looked into this; and the main problem seems to be that order 
relations are antisymmetric.
An expression could be only used as a predicate during an or simplification if 
the relation is not antisymmetric.

In case of:
{code}
aRx or ( xRb and c )
{code}
when we use {{not(aRx)}} as a predicate; if antisymmetry applies it could 
become {{xRa}}
but note that in case of {{(xRa and xRb)}} we do not know anything about the 
relation of a and b.

R could be < or some other inequality operator.

I think the requirement to apply CALCITE-2247 logic is that relation in the 
predicate must have "partial equvivalence" properties.

I'm trying to save this feature in [this 
branch|https://github.com/kgyrtkirk/calcite/tree/3192-simplifyor-erro].


was (Author: kgyrtkirk):
[~jbal...@gmail.com] throwing away the predicates might save this case; but may 
probably not fix all cases; and the usage of this predicates is usefull; could 
help further symplify cases - so I try to save it :)

I've further looked into this; and the main problem seems to be that order 
relations are antisymmetric.
An expression could be only used as a predicate during an or simplification if 
the relation is not antisymmetric.

In case of:
{code}
aRx or ( xRb and c )
{code}
when we use {{not(aRx)}} as a predicate; if antisymmetry applies it could 
become {{xRa}}
but note that in case of {{(xRa and xRb)}} we do not know anything about the 
relation of a and b.

R could be < or some other inequality operator.

I think the requirement to apply CALCITE-2247 logic is that relation in the 
predicate must have "partial equvivalence" properties.

> Simplify OR incorrectly weaks condition
> ---------------------------------------
>
>                 Key: CALCITE-3192
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3192
>             Project: Calcite
>          Issue Type: Bug
>            Reporter: Jess Balint
>            Priority: Major
>             Fix For: 1.21.0
>
>
> 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
(v7.6.14#76016)

Reply via email to