hadoop-pig-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Pi Song (JIRA)" <j...@apache.org>
Subject [jira] Commented: (PIG-332) Comparing float column with double constant fails
Date Wed, 23 Jul 2008 10:57:31 GMT

    [ 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.


Mime
View raw message