ankitsultana commented on code in PR #17083:
URL: https://github.com/apache/pinot/pull/17083#discussion_r2467160690


##########
pinot-core/src/main/java/org/apache/pinot/core/common/datablock/DataBlockBuilder.java:
##########
@@ -147,6 +147,7 @@ public static RowDataBlock buildFromRows(List<Object[]> 
rows, DataSchema dataSch
               fixedSize.putInt(dictId);
               break;
             case BYTES:
+            case UUID:
               setColumn(fixedSize, varSize, (ByteArray) value);

Review Comment:
   Could we store this as a `long[2]` or maybe the Java `UUID` type directly? I 
think performance delta could get significant based on the operations involved 
with the two approaches.



##########
pinot-spi/src/main/java/org/apache/pinot/spi/utils/UUIDUtils.java:
##########
@@ -0,0 +1,178 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.pinot.spi.utils;
+
+import java.nio.ByteBuffer;
+import java.util.UUID;
+
+
+/**
+ * Utility class for UUID serialization and deserialization.
+ * UUIDs are stored as fixed 16-byte arrays (most significant bits + least 
significant bits).
+ */
+public class UUIDUtils {
+  private UUIDUtils() {
+  }
+
+  /**
+   * Returns the number of bytes in a serialized UUID (always 16 bytes).
+   */
+  public static int byteSize() {
+    return 16;
+  }
+
+  /**
+   * Validates if a string is a valid UUID format.
+   * @param str the string to validate
+   * @return true if the string is a valid UUID, false otherwise
+   */
+  public static boolean isValidUUID(String str) {
+    if (str == null || str.isEmpty()) {
+      return false;
+    }
+    try {
+      UUID.fromString(str);
+      return true;
+    } catch (IllegalArgumentException e) {
+      return false;
+    }
+  }
+
+  /**
+   * Serializes a UUID string to a 16-byte array.
+   * Accepts both standard UUID format (with dashes) and 32-character hex 
format (without dashes).

Review Comment:
   Why do we want to support 32-character hex format? Since this will be a hot 
part of the code, might be better to keep it simple



-- 
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