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

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

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.


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

Posted by "Pi Song (JIRA)" <ji...@apache.org>.
    [ 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.


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

Posted by "Olga Natkovich (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olga Natkovich updated PIG-332:
-------------------------------

    Priority: Minor  (was: Major)

This just needs to be documented

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


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

Posted by "Alan Gates (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/PIG-332?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alan Gates updated PIG-332:
---------------------------

    Priority: Major  (was: Minor)

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