diff --git a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveBucketing.java b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveBucketing.java index f2da541edba2..082f2265d7f3 100644 --- a/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveBucketing.java +++ b/presto-hive/src/main/java/io/prestosql/plugin/hive/HiveBucketing.java @@ -51,6 +51,8 @@ import static io.prestosql.plugin.hive.HiveErrorCode.HIVE_INVALID_METADATA; import static io.prestosql.plugin.hive.HiveUtil.getRegularColumnHandles; import static java.lang.Double.doubleToLongBits; +import static java.lang.Float.floatToIntBits; +import static java.lang.Float.intBitsToFloat; import static java.lang.Math.toIntExact; import static java.lang.String.format; import static java.util.Map.Entry; @@ -141,7 +143,8 @@ private static int hash(TypeInfo type, Block block, int position) long bigintValue = prestoType.getLong(block, position); return (int) ((bigintValue >>> 32) ^ bigintValue); case FLOAT: - return (int) prestoType.getLong(block, position); + // convert to canonical NaN if necessary + return floatToIntBits(intBitsToFloat(toIntExact(prestoType.getLong(block, position)))); case DOUBLE: long doubleValue = doubleToLongBits(prestoType.getDouble(block, position)); return (int) ((doubleValue >>> 32) ^ doubleValue);