xiangfu0 commented on code in PR #18140:
URL: https://github.com/apache/pinot/pull/18140#discussion_r3107398938
##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/Schema.java:
##########
@@ -621,6 +622,9 @@ public void validate() {
String fieldName = fieldSpec.getName();
try {
validate(fieldType, dataType);
+ if (dataType == DataType.UUID && !fieldSpec.isSingleValueField()) {
Review Comment:
Done. Moved the UUID MV restriction out of `Schema.validate()` — it was
redundant with the check already in
`SchemaUtils.validateMultiValueCompatibility()` alongside JSON and BIG_DECIMAL.
Updated the javadoc to note that MV compatibility checks live in
`SchemaUtils.validate()`. Updated the test to use `checkValidationFails()`
style, consistent with the BIG_DECIMAL and JSON tests.
##########
pinot-spi/src/main/java/org/apache/pinot/spi/utils/UuidUtils.java:
##########
@@ -0,0 +1,144 @@
+/**
+ * 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.Arrays;
+import java.util.UUID;
+
+
+/**
+ * Utilities for Pinot's logical UUID type.
+ *
+ * <p>UUID values are externally represented as canonical lowercase RFC 4122
strings and internally represented as
+ * fixed-width 16-byte values.
+ */
+public final class UuidUtils {
+ public static final int UUID_NUM_BYTES = 16;
+ public static final byte[] NIL_UUID_BYTES = new byte[UUID_NUM_BYTES];
Review Comment:
The field is already named `NULL_UUID_BYTES` and the method
`nullUuidBytes()` in the current code — this was already updated in an earlier
revision.
##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/segment/index/readers/BytesDictionary.java:
##########
@@ -47,7 +54,7 @@ public int indexOf(ByteArray bytesValue) {
@Override
public int insertionIndexOf(String stringValue) {
- return binarySearch(BytesUtils.toBytes(stringValue));
+ return binarySearch(parseBytes(stringValue));
Review Comment:
The only change to BytesDictionary in this PR is removing a blank line — no
UUID-specific handling was added. UUID columns use BytesDictionary as-is since
UUID is stored as 16-byte BYTES internally, so the existing dictionary behavior
is correct without any special handling.
--
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]