xiangfu0 opened a new pull request, #18973:
URL: https://github.com/apache/pinot/pull/18973

   ## Summary
   The schema recommender's data generator had no support for `UUID` columns, 
so recommending a schema containing a UUID column would fail. This adds UUID 
sample-data generation. Split out from the UUID PR stack as an independent 
change per review.
   
   ## Changes
   - **`UuidGenerator`** (new): generates canonical RFC-4122 UUID strings. The 
number of distinct values is bounded by the requested cardinality — a fixed 
random high-order half combined with a low-order counter that cycles `[1, 
cardinality]`, mirroring `StringGenerator`. (Values are not version-4; the 
version/variant bits are not set, which is irrelevant for sample data — they 
remain canonically-formatted, parseable UUID strings.)
   - **`GeneratorFactory`**: route `DataType.UUID` to `UuidGenerator`.
   - **`AvroSchemaUtil.toAvroSchemaJsonObject`**: map a UUID column to an Avro 
`string` annotated with `logicalType: "uuid"` (consistent with the 
original-type approach already used for `BOOLEAN` and `TIMESTAMP`) instead of 
collapsing to raw `bytes`, so generated sample data round-trips as canonical 
UUID strings. This is a recommender-only helper with a single caller 
(`AvroWriter`); ingestion and segment-conversion Avro mapping are untouched.
   
   ## Testing
   - `UuidGeneratorTest`: single-value canonical output, cardinality bounding + 
counter cycling, null-`numberOfValuesPerEntry` default, multi-value list.
   - `AvroSchemaUtilTest`: UUID → `logicalType:uuid` string mapping.
   - `AvroWriterTest`: end-to-end round-trip — a UUID column generates, writes 
to Avro, and reads back as canonical UUID strings.
   


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