This is related to
SPARK-26021 where some things were fixed but there is still a lot that is not consistent.
When parsing SQL -0.0 is turned into 0.0. This can produce quick results that appear to be correct but are totally inconsistent for the same operators.
This also shows up in sorts
But not for a equi-join or for an aggregate
This can lead to some very odd results. Like an equi-join with a filter that logically should do nothing, but ends up filtering the result to nothing.
Hive never normalizes -0.0 to 0.0 so this results in non-ieee complaint behavior everywhere, but at least it is consistently odd.
MySQL, Oracle, Postgres, and SQLite all appear to normalize the -0.0 to 0.0.
The root cause of this appears to be that the java implementation of Double.compare and Float.compare for open JDK places -0.0 < 0.0.
This is not documented in the java docs but it is clearly documented in the code, so it is not a "bug" that java is going to fix.
It is also consistent with what is in the java docs for Double.equals
To be clear I am filing this mostly to document the current state rather than to think it needs to be fixed ASAP. It is a rare corner case, but ended up being really frustrating for me to debug what was happening.