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

Jesus Camacho Rodriguez commented on CALCITE-1413:
--------------------------------------------------

Thanks for the pointer [~julianhyde]; I will take a look and try to integrate 
it with the code that I already have. Btw, note that I do not intend to include 
this in 1.10.0; I consider it a bit 'risky' since a small mistake can lead to 
incorrect results, so I prefer to defer it to next release to have some extra 
time.

> 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
>             Fix For: 1.11.0
>
>
> Another possible simplification for CASE statements that return boolean 
> values.
> {code:sql}
> CASE
>  WHEN p1 THEN e1
>  WHEN p2 THEN e2
>  ELSE TRUE
> END
> {code}
> where e1...en are boolean expressions, can be rewritten into:
> {code:sql}
> (p1 and e1) or (p2 and e2 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)

Reply via email to