xiangfu0 commented on code in PR #18870:
URL: https://github.com/apache/pinot/pull/18870#discussion_r3547837607
##########
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/genericrow/GenericRowDeserializer.java:
##########
@@ -164,6 +164,18 @@ public void deserialize(long offset, GenericRow buffer) {
multiValue[j] = new String(stringBytes, UTF_8);
}
break;
+ case BYTES:
+ // Used by MV UUID (storedType=BYTES). Mirrors the writer in
GenericRowSerializer:
+ // each element is length-prefixed.
Review Comment:
Removed the comment.
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
pinot-core/src/main/java/org/apache/pinot/core/segment/processing/genericrow/GenericRowDeserializer.java:
##########
@@ -366,6 +378,26 @@ public int compare(long offset1, long offset2, int
numFieldsToCompare) {
offset2 += numBytes2;
}
break;
+ case BYTES:
+ // Used by MV UUID (storedType=BYTES). Element-wise unsigned byte
compare matches the SV BYTES
+ // ordering above.
Review Comment:
Removed this comment and the matching one in `GenericRowSerializer` (the MV
BYTES write branch).
_🤖 Addressed by [Claude Code](https://claude.com/claude-code)_
##########
pinot-core/src/main/java/org/apache/pinot/core/util/SegmentProcessorAvroUtils.java:
##########
@@ -57,20 +61,50 @@ public static GenericData.Record
convertGenericRowToAvroRecord(GenericRow generi
*/
public static GenericData.Record convertGenericRowToAvroRecord(GenericRow
genericRow,
GenericData.Record reusableRecord, Set<String> fields) {
+ Schema avroSchema = reusableRecord.getSchema();
for (String field : fields) {
Object value = genericRow.getValue(field);
if (value instanceof Object[]) {
- reusableRecord.put(field, Arrays.asList((Object[]) value));
+ Schema.Field avroField = avroSchema.getField(field);
+ if (avroField != null && isUuidArrayLogicalType(avroField.schema())) {
+ // MV UUID columns are emitted with an Avro
array<string{logicalType:uuid}> schema; convert each
+ // 16-byte element to its canonical UUID string so
GenericDatumWriter accepts the record.
Review Comment:
`GenericDatumWriter` here uses the default `GenericData` with no UUID
logical-type `Conversion` registered, so for a `string{logicalType:uuid}` field
it writes the base Avro type — a `CharSequence`. So yes: it takes the canonical
UUID string, which is why the 16-byte value is rendered via
`UuidUtils.toString(...)` before `put`. A raw `byte[]` or `java.util.UUID`
would only work if a UUID `Conversion` were registered on the writer's
`GenericData`, which we don't do here.
_🤖 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]