the-other-tim-brown commented on code in PR #13411:
URL: https://github.com/apache/hudi/pull/13411#discussion_r2143615810
##########
hudi-common/src/main/java/org/apache/hudi/avro/AvroSchemaCache.java:
##########
@@ -33,7 +35,12 @@ public class AvroSchemaCache {
// Ensure that there is only one variable instance of the same schema within
an entire JVM lifetime
- private static final LoadingCache<Schema, Schema> SCHEMA_CACHE =
Caffeine.newBuilder().weakValues().maximumSize(1024).build(k -> k);
+ private static final LoadingCache<Schema, Schema> SCHEMA_CACHE =
Caffeine.newBuilder().weakValues().maximumSize(1024).build(inputSchema -> {
+ if (inputSchema.equals(HoodieMetadataRecord.getClassSchema())) {
Review Comment:
The optimization happens when checking if two schemas are equal to each
other. Caching the generated version means the equality check can pass on
checking if it is the same instance instead of inspecting all the fields.
--
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]