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

Rohini Palaniswamy commented on PIG-3375:
-----------------------------------------

+1
                
> CASE does not preserve the order of when branches
> -------------------------------------------------
>
>                 Key: PIG-3375
>                 URL: https://issues.apache.org/jira/browse/PIG-3375
>             Project: Pig
>          Issue Type: Bug
>            Reporter: Cheolsoo Park
>            Assignee: Cheolsoo Park
>             Fix For: 0.12
>
>         Attachments: PIG-3375.patch
>
>
> Currently CASE expression builds nested BinCond expressions in the following 
> order: from top to bottom when branches => from in to out bin conds.
> This can be confusing if non-mutually exclusive conditions are used in when 
> branches. For example,
> {code}
> CASE 
>     WHEN x > 100 THEN 'a'
>     WHEN x > 50  THEN 'b'
>     ELSE 'c'
> END
> {code}
> is converted to
> {code}
> x > 50 ? 'b' : ( x > 100 ? 'a' : 'c' )
> {code}
> Now if x is 1000, the result is 'b', which is not quite expected.
> Instead, we should construct nested BinCond expressions in the same order as 
> that of when branches, i.e.
> {code}
> x > 100 ? 'a' : ( x > 50 ? 'b' : 'c' )
> {code}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to