You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Zoltan Haindrich (JIRA)" <ji...@apache.org> on 2019/02/24 14:38:00 UTC

[jira] [Resolved] (CALCITE-2841) Simplification: push negation into Case expression

     [ https://issues.apache.org/jira/browse/CALCITE-2841?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Zoltan Haindrich resolved CALCITE-2841.
---------------------------------------
       Resolution: Fixed
    Fix Version/s: 1.19.0

fixed in [c3fd74a897ca1b469b6b776baeaa3c660ce5876a|https://github.com/apache/calcite/commit/c3fd74a897ca1b469b6b776baeaa3c660ce5876a]

> Simplification: push negation into Case expression
> --------------------------------------------------
>
>                 Key: CALCITE-2841
>                 URL: https://issues.apache.org/jira/browse/CALCITE-2841
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.19.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Why would this be usefull?
> * right now a boolean CASE expressions are translated into AND/ORs in most cases ; "disjunction of conjuctions"
> * AND/OR simplification could "push" the NOT into them; but only after the CASE conversion; so the expression becames a "conjunction of disjunctions" and all the other simplification rules are working hard to restore order....
> * if the push of NOT would happen earlier it would be better because it could address complex cases better
> {code:java}
>   @Test public void testNotIntoCase() {
>     checkSimplify(
>         not(
>             case_(
>                 isTrue(vBool()), vBool(1),
>                 vBool(2))),
>         "CASE(IS TRUE(?0.bool0), NOT(?0.bool1), NOT(?0.bool2))");
>   }
> {code}
> actually NOT right now stops the simplification recursion so it would be best to also enable that as well; in case NOT is not is not pushed/handled - unknownAs need to be negated.
> {code}
>  @Test public void testNotRecursion() {
>     checkSimplify(
>         not(coalesce(nullBool, trueLiteral)),
>         "false");
>   }
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)