wombatu-kun commented on code in PR #19000:
URL: https://github.com/apache/hudi/pull/19000#discussion_r3409435935


##########
hudi-common/src/main/java/org/apache/hudi/metadata/HoodieTableMetadataUtil.java:
##########
@@ -276,15 +276,21 @@ public static Map<String, 
HoodieColumnRangeMetadata<Comparable>> collectColumnRa
     final Properties properties = new Properties();
     properties.setProperty(HoodieStorageConfig.WRITE_UTC_TIMEZONE.key(),
         storageConfig.getString(HoodieStorageConfig.WRITE_UTC_TIMEZONE.key(), 
HoodieStorageConfig.WRITE_UTC_TIMEZONE.defaultValue().toString()));
+    // getNonNullType() rebuilds the union-member wrappers for nullable fields 
and depends only on the
+    // (fixed) target fields, so resolve it once per field instead of once per 
record per field. Holding
+    // a stable HoodieSchema instance also lets its toAvroSchema() memoize 
across records.

Review Comment:
   `toAvroSchema()` is a Lombok `@Getter` over the stored `avroSchema` field in 
`HoodieSchema` (the class is annotated `@Getter`, and `toAvroSchema()` just 
aliases the generated `getAvroSchema()`): it returns a pre-built Schema 
reference and neither memoizes nor re-derives anything per record. The real win 
is avoiding the per-record `getNonNullType()` allocation (`getTypes()` rebuilds 
the union-member wrappers), which the first sentence already covers. Suggest 
dropping the `toAvroSchema()` memoize clause (and the matching line in the PR 
description) so the comment does not assert a mechanism the code does not have.



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