danny0405 commented on code in PR #13852:
URL: https://github.com/apache/hudi/pull/13852#discussion_r2328480926
##########
hudi-common/src/main/java/org/apache/hudi/avro/HoodieAvroUtils.java:
##########
@@ -161,6 +162,25 @@ public static <T extends IndexedRecord>
ByteArrayOutputStream indexedRecordToByt
}
}
+ public static byte[] convertIndexedRecordToAvroFileFormat(IndexedRecord
record) {
+ try {
+ byte[] bytes = HoodieAvroUtils.avroToBytes(record);
+ if (bytes.length >= 4 && bytes[0] == 0x4F && bytes[1] == 0x62 &&
bytes[2] == 0x6A && bytes[3] == 0x01) { // "Obj" magic bytes to check if its
already in avro file format
Review Comment:
it is because the avro metadata in V1 archived timeline is a nested field
within the metadata entry so that there is no such magic code? For V2 we also
uses `HoodieAvroUtils.avroToBytes` though.
I see we always use `GenericDatumWriter` or `GenericDatumReader` to Ser/De
records there, wondering what causes this discrepancies.
--
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]