[
https://issues.apache.org/jira/browse/CALCITE-3803?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17038216#comment-17038216
]
Zoltan Haindrich commented on CALCITE-3803:
-------------------------------------------
some notes:
Right now we use predicates during simplification; let's say we have (a<1) as a
predicate; then from that we can conclude that a<0 is also true/etc.
{code}
(a<1) implies (a<0)
{code}
CALCITE-3192 have uncovered that introducing the {{not (a>1)}} predicate will
lead to incorrect results because:
{code}
not (a>1) == a<=1
(a<=1) implies (a<0) -- which is wrong; and it even not touched the example in
the description...
{code}
I think what would be correct is to introduce weak predicates; by weak I mean
they should be implied rather that used to imply other things.
{code}
weak not (a>1) == weak a<1
(a<3) implies a<1 -- which will do the simpliciation correctly
{code}
note: for simple boolean expressions it doesn't matter if we have have it as a
weak predicate or not...
> Enhance RexSimplify to simplify 'a>1 or (a<3 and b)' to 'a>1 or b' if column
> a is not nullable
> ----------------------------------------------------------------------------------------------
>
> Key: CALCITE-3803
> URL: https://issues.apache.org/jira/browse/CALCITE-3803
> Project: Calcite
> Issue Type: Improvement
> Components: core
> Reporter: Chunwei Lei
> Assignee: Chunwei Lei
> Priority: Major
>
> For {{a>1 or (a<3 and b)}}, with short-circuit, we know {{a<=1}} if {{a>1}}
> is false when column a is not nullable. Then {{(a<3 and b) can be simplified
> to b}}. Thus, {{a>1 or (a<3 and b)is simplified to a>1 or b.}}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)