Skip to content

Commit

Permalink
Fix comment for Timestamp in HiveBucketing
Browse files Browse the repository at this point in the history
  • Loading branch information
kewang1024 committed Jun 10, 2024
1 parent fb2a314 commit 3d06a01
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -174,9 +174,9 @@ private static int hash(TypeInfo type, Block block, int position)
return toIntExact(days);
case TIMESTAMP:
long millisSinceEpoch = prestoType.getLong(block, position);
// seconds << 30 + nanoseconds
long secondsAndNanos = (Math.floorDiv(millisSinceEpoch, 1000L) << 30) + Math.floorMod(millisSinceEpoch, 1000L);
return (int) ((secondsAndNanos >>> 32) ^ secondsAndNanos);
// seconds << 30 + milliseconds
long secondsAndMillis = (Math.floorDiv(millisSinceEpoch, 1000L) << 30) + Math.floorMod(millisSinceEpoch, 1000L);
return (int) ((secondsAndMillis >>> 32) ^ secondsAndMillis);
default:
throw new UnsupportedOperationException("Computation of Hive bucket hashCode is not supported for Hive primitive category: " + primitiveCategory.toString() + ".");
}
Expand Down Expand Up @@ -233,9 +233,9 @@ private static int hash(TypeInfo type, Object value)
return toIntExact(days);
case TIMESTAMP:
long millisSinceEpoch = (long) value;
// seconds << 30 + nanoseconds
long secondsAndNanos = (Math.floorDiv(millisSinceEpoch, 1000L) << 30) + Math.floorMod(millisSinceEpoch, 1000L);
return (int) ((secondsAndNanos >>> 32) ^ secondsAndNanos);
// seconds << 30 + milliseconds
long secondsAndMillis = (Math.floorDiv(millisSinceEpoch, 1000L) << 30) + Math.floorMod(millisSinceEpoch, 1000L);
return (int) ((secondsAndMillis >>> 32) ^ secondsAndMillis);
default:
throw new UnsupportedOperationException("Computation of Hive bucket hashCode is not supported for Hive primitive category: " + primitiveCategory.toString() + ".");
}
Expand Down

0 comments on commit 3d06a01

Please sign in to comment.