Lenni Kuff created HIVE-11174: --------------------------------- Summary: 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 Priority: Critical
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: "0.0d is considered by this method to be greater than -0.0d" http://docs.oracle.com/javase/7/docs/api/java/lang/Double.html#compareTo(java.lang.Double) 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 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)