calcite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jesus Camacho Rodriguez (JIRA)" <j...@apache.org>
Subject [jira] [Created] (CALCITE-1413) New CASE statement simplification
Date Wed, 05 Oct 2016 12:50:20 GMT
Jesus Camacho Rodriguez created CALCITE-1413:
------------------------------------------------

             Summary: New CASE statement simplification
                 Key: CALCITE-1413
                 URL: https://issues.apache.org/jira/browse/CALCITE-1413
             Project: Calcite
          Issue Type: Improvement
          Components: core
    Affects Versions: 1.9.0
            Reporter: Jesus Camacho Rodriguez
            Assignee: Jesus Camacho Rodriguez


Another possible simplification for CASE statements.

{code:sql}
CASE
 WHEN p1 THEN x
 WHEN p2 THEN y
 ELSE TRUE
END
{code}

can be rewritten into:
{code:sql}
(p1 and x) or (p2 and y and not(p1)) or (not(p1) and not(p2))
{code}
if p1...pn cannot be nullable.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message