You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pig.apache.org by "Pi Song (JIRA)" <ji...@apache.org> on 2008/07/23 12:57:31 UTC

[jira] Commented: (PIG-332) Comparing float column with double constant fails

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

Pi Song commented on PIG-332:
-----------------------------


The result in Java of:-

{noformat}
        double a = 1.42D ;
        float b = 1.42F ;
        System.out.println(a == b) ;
{noformat}

is "false"

> Comparing float column with double constant fails
> -------------------------------------------------
>
>                 Key: PIG-332
>                 URL: https://issues.apache.org/jira/browse/PIG-332
>             Project: Pig
>          Issue Type: Bug
>    Affects Versions: types_branch
>            Reporter: Pradeep Kamath
>            Priority: Minor
>             Fix For: types_branch
>
>
> Script :
> {code}
> a = load '/user/pig/tests/data/singlefile/studenttab10k' using PigStorage() as (name:chararray, age:int, gpa:float);
> b = filter a by  name == 'fred allen' and age == 61 and gpa == 1.42;
> store b into '/user/pig/tests/results/FilterEq_7.out' using PigStorage;
> {code}
> Result has 0 rows when infact there should be 1 row.
> The reason is within Pig code in POCast, we do 
> {code}
> res.result = new Double(((Float)res.result).doubleValue());
> {code}
> to promote the column to a double. As a results of the above code, the precisions don't match and hence the filter throws away the row.
> This could be treated as "Working as designed" and the user may need to explicity do gpa == 1.42f - just wanted it to be discussed and pointed out in the 2.0 release notes.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.