xiangfu0 commented on code in PR #18973:
URL: https://github.com/apache/pinot/pull/18973#discussion_r3563475060
##########
pinot-plugins/pinot-input-format/pinot-avro-base/src/test/java/org/apache/pinot/plugin/inputformat/avro/AvroSchemaUtilTest.java:
##########
@@ -60,6 +58,17 @@ public void
testToAvroSchemaJsonObjectRejectsUnsupportedType() {
() -> AvroSchemaUtil.toAvroSchemaJsonObject(new
DimensionFieldSpec("col", DataType.BIG_DECIMAL, true)));
}
+ /// A UUID column is represented faithfully as an Avro string annotated with
logicalType "uuid". The recommender
+ /// pipeline only ever emits single-value fields (see
`DataGenerator#buildSpec`), matching every sibling case.
Review Comment:
Reworded to avoid implying the generated values are always single-valued:
the comment now says `DataGenerator#buildSpec` marks the recommender schema
FieldSpec single-value (not the data values), which is why
`toAvroSchemaJsonObject` emits a scalar union like every sibling type.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
pinot-controller/src/main/java/org/apache/pinot/controller/recommender/data/generator/UuidGenerator.java:
##########
@@ -0,0 +1,75 @@
+/**
+ * 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.controller.recommender.data.generator;
+
+import com.google.common.annotations.VisibleForTesting;
+import java.util.Random;
+import java.util.UUID;
+
+
+/// Generates canonical RFC-4122 UUID strings for a column of type UUID. UUID
is a logical type whose recommender Avro
+/// schema is a `string` annotated with `logicalType: uuid` (see
`AvroSchemaUtil#toAvroSchemaJsonObject`), so the
+/// generated value is the canonical string form and the writer serializes it
directly.
+///
+/// The number of distinct values is bounded by the requested cardinality: a
fixed random high-order half is combined
+/// with a low-order counter that cycles `[1, cardinality]`, mirroring
`StringGenerator`. Values are not RFC-4122
+/// version-4 (the version/variant bits are not set), which is irrelevant for
sample data — they remain
+/// canonically-formatted, parseable UUID strings.
Review Comment:
Reworded to remove the contradiction: dropped the "RFC-4122" claim from the
first line, and the javadoc now states these are deliberately not RFC-4122
version-4 UUIDs (version/variant bits unset). Sample data only needs distinct,
canonically-formatted, parseable values, so I kept the reword rather than
setting the bits.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
--
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]