hive-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergio Peña (JIRA) <j...@apache.org>
Subject [jira] [Comment Edited] (HIVE-11174) Hive does not treat floating point signed zeros as equal (-0.0 should equal 0.0 according to IEEE floating point spec)
Date Wed, 15 Jul 2015 14:49:05 GMT

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

Sergio Peña edited comment on HIVE-11174 at 7/15/15 2:48 PM:
-------------------------------------------------------------

Thanks [~xuefuz]. I committed this patch to master.
The same query runs correct on Hive.


was (Author: spena):
Thanks [~xuefuz]
The same query runs correct on Hive.

> Hive does not treat floating point signed zeros as equal (-0.0 should equal 0.0 according
to IEEE floating point spec) 
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-11174
>                 URL: https://issues.apache.org/jira/browse/HIVE-11174
>             Project: Hive
>          Issue Type: Bug
>          Components: Query Processor
>    Affects Versions: 1.2.0
>            Reporter: Lenni Kuff
>            Assignee: Sergio Peña
>            Priority: Critical
>             Fix For: 2.0.0
>
>         Attachments: HIVE-11174.1.patch
>
>
> Hive does not treat floating point signed zeros as equal (-0.0 should equal 0.0).  This
is because Hive uses Double.compareTo(), which states (http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#compareTo(java.lang.Double):
> bq. 0.0d is considered by this method to be greater than -0.0d
> The IEEE 754 floating point spec specifies that signed -0.0 and 0.0 should be treated
as equal. From the Wikipedia article (https://en.wikipedia.org/wiki/Signed_zero#Comparisons):
> bq. negative zero and positive zero should compare as equal with the usual (numerical)
comparison operators
> Java's compareTo method is implemented to allow for ordering of object instances (in
a hash table or similar), but Hive should abide by the IEEE spec.
> How to reproduce:
> {code}
> select 1 where 0.0=-0.0;
> Returns no results.
> select 1 where -0.0<0.0;
> Returns 1
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message