ConeyLiu commented on code in PR #7791:
URL: https://github.com/apache/iceberg/pull/7791#discussion_r1222530986


##########
core/src/main/java/org/apache/iceberg/data/avro/DecoderResolver.java:
##########
@@ -49,11 +50,12 @@ public static <T> T resolveAndRead(
     return value;
   }
 
-  private static ResolvingDecoder resolve(Decoder decoder, Schema readSchema, 
Schema fileSchema)
+  @VisibleForTesting
+  static ResolvingDecoder resolve(Decoder decoder, Schema readSchema, Schema 
fileSchema)
       throws IOException {
     Map<Schema, Map<Schema, ResolvingDecoder>> cache = DECODER_CACHES.get();
     Map<Schema, ResolvingDecoder> fileSchemaToResolver =
-        cache.computeIfAbsent(readSchema, k -> Maps.newHashMap());
+        cache.computeIfAbsent(readSchema, k -> new WeakHashMap<>());

Review Comment:
   Change to `WeakHashMap` to solve the problems mentioned in problem 2.



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

Reply via email to