You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by "ankitsultana (via GitHub)" <gi...@apache.org> on 2024/03/21 16:55:14 UTC
Re: [PR] Deterministic Hash Function for UUID Primary Keys [pinot]
ankitsultana commented on code in PR #12538:
URL: https://github.com/apache/pinot/pull/12538#discussion_r1534288165
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/HashUtils.java:
##########
@@ -36,6 +40,35 @@ public static byte[] hashMD5(byte[] bytes) {
return Hashing.md5().hashBytes(bytes).asBytes();
}
+ /**
+ * For use-cases where the primary-key is set to columns that are guaranteed to be type-4 UUIDs, this hash-function
+ * will reduce the number of bytes required from 36 to 16 for each UUID, without losing any precision. This leverages
+ * the fact that a type-4 UUID is essentially a 16-byte value.
+ */
+ public static byte[] hashUUIDv4(byte[] bytes) {
Review Comment:
Updated. The function should be able to handle any UUID conformant to RFC 4122 (Java's UUID is conformant to the same). Marking PR as ready for review. Lmk your thoughts.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org