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

Prashant Kommireddi commented on PIG-2544:
------------------------------------------

Hi Vivek,

What should be the expected behavior here for something declared within 
parenthesis, (-1.0)? For a ConstantExpression -1.0 is different from (-1.0) and 
it seems like the right behavior in this case?

Another way of looking at it is, let's say we enclose empty string within ()

{code}
grunt> B = foreach A generate ((a eq (''))?((b eq '')? (-1.0) :(c/100.0)): 
(c/100.0)) ;
{code}

This would rightly error out too as ('') is a tuple, not a primitive chararray.
                
> ConstantExpression considers (-1.0) as a tuple rather than double
> -----------------------------------------------------------------
>
>                 Key: PIG-2544
>                 URL: https://issues.apache.org/jira/browse/PIG-2544
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: 0.9.1, 0.10.0
>            Reporter: Vivek Padmanabhan
>
> {code}
> A = load 'i1' as (a,b,c:double);
> B = foreach A generate ((a eq '')?((b eq '')? (-1.0) :(c/100.0)): (c/100.0)) ;
> dump B;
> {code}
> In Pig 0.9 the above script fails with exception : "Unsupported input type 
> for BinCond: left hand side: tuple; right hand side: double"
> The same script works fine with Pig 0.8.
> I think the issue is ConstantExpression uses  
> Util.translateFieldSchema(DataType.determineFieldSchema(val))
> which considers  (-1.0) as  a tuple rather than double in this case.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to