[jira] [Commented] (CALCITE-3192) Simplify OR incorrectly weaks condition

2019-07-29 Thread Julian Hyde (JIRA)


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

Julian Hyde commented on CALCITE-3192:
--

Can you change "weaks" to "weakens" in the JIRA and commit titles. "Weaks" is 
not a verb.

Can you document or otherwise clean up {{isSupportedAsOrPredicate}}? How did 
you derive the list of which predicates are supported? What is an "or 
predicate" anyway?

This double (or triple) negative is difficult to read:

{code}
if (!(Predicate.of(t) == null || !isSupportedAsOrPredicate(t))) {
  continue;
}
{code}

> 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
>  Labels: pull-request-available
> Fix For: 1.21.0
>
>  Time Spent: 10m
>  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
(v7.6.14#76016)


[jira] [Commented] (CALCITE-3192) Simplify OR incorrectly weaks condition

2019-07-25 Thread Zoltan Haindrich (JIRA)


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

Zoltan Haindrich commented on CALCITE-3192:
---

[~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)


[jira] [Commented] (CALCITE-3192) Simplify OR incorrectly weaks condition

2019-07-12 Thread Jess Balint (JIRA)


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

Jess Balint commented on CALCITE-3192:
--

this seems to work but one new test failure arises which I haven't checked yet:

https://github.com/jbalint/calcite/blob/e8b154db56bf4681f0affb3aa049abb72832678a/core/src/main/java/org/apache/calcite/rex/RexSimplify.java#L517

> 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)


[jira] [Commented] (CALCITE-3192) Simplify OR incorrectly weaks condition

2019-07-12 Thread Zoltan Haindrich (JIRA)


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

Zoltan Haindrich commented on CALCITE-3192:
---

{code}
z or ( x and y )
z or ( x and y and !z )
{code}
part of the problem is that !z is retained as a predicate; so its not there 
physically
but when (y -> !z) is true then y is removed incorrectly

the fully correct way would be to add this things to the expression; but that 
would just create a lot of redundant noise...I'll think about it

> 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
>
> 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)