chenboat commented on code in PR #12538:
URL: https://github.com/apache/pinot/pull/12538#discussion_r1543747564


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/utils/HashUtils.java:
##########
@@ -36,6 +40,33 @@ public static byte[] hashMD5(byte[] bytes) {
     return Hashing.md5().hashBytes(bytes).asBytes();
   }
 
+  /**
+   * Returns a byte array that is a concatenation of the binary representation 
of each of the passed UUID values. This
+   * is done by getting a String from each value by calling {@link 
Object#toString()}, which is then used to create a
+   * {@link UUID} object. The 16 bytes of each UUID are appended to a buffer 
which is then returned in the result.
+   * If any of the value is not a valid UUID, then this function appends the 
UTF-8 string bytes of all elements and
+   * returns that in the result.
+   */
+  public static byte[] hashUUID(Object[] values) {
+    byte[] result = new byte[values.length * 16];
+    ByteBuffer byteBuffer = 
ByteBuffer.wrap(result).order(ByteOrder.BIG_ENDIAN);
+    for (Object value : values) {
+      if (value == null) {
+        return concatenate(values);
+      }
+      String uuidString = value.toString();

Review Comment:
   nit: var uuidString is used only once. Put it in line 60 to save this line.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to