voonhous commented on code in PR #18967:
URL: https://github.com/apache/hudi/pull/18967#discussion_r3426909945


##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieAvroDataBlock.java:
##########
@@ -507,9 +507,11 @@ public byte[] getBytes(Schema schema) throws IOException {
       output.writeInt(records.size());
 
       // 3. Write the records
+      // schema is loop-invariant; wrap it once instead of rebuilding the 
HoodieSchema per record
+      HoodieSchema hoodieSchema = HoodieSchema.fromAvroSchema(schema);

Review Comment:
   Good catch, switched to AvroToHoodieSchemaCache.intern(schema) for 
consistency with the other touched sites. Bonus: reusing one cached instance 
keeps HoodieSchema identity stable across getBytes calls so the per-record 
caches stay warm instead of rebuilding per block.



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

Reply via email to