yihua commented on code in PR #11935:
URL: https://github.com/apache/hudi/pull/11935#discussion_r1757580662
##########
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieNativeAvroHFileReader.java:
##########
@@ -244,14 +248,32 @@ private static GenericRecord
getRecordFromKeyValue(KeyValue keyValue,
readerSchema);
}
- private synchronized HFileReader getSharedHFileReader() {
- try {
- if (!sharedHFileReader.isPresent()) {
- sharedHFileReader = Option.of(newHFileReader());
+ private byte[] getHFileMetaInfoFromCache(String key) throws IOException {
+ if (!PRELOADED_META_INFO_KEYS.contains(key)) {
+ throw new
IllegalStateException("HoodieNativeAvroHFileReader#getHFileMetaInfoFromCache"
+ + " should only be called on supported meta info keys; this key is
not supported: "
+ + key);
+ }
+ byte[] bytes = metaInfoMap.get(key);
Review Comment:
> Can we do a compute if absent here?
I'm updating the whole map so it is anti-pattern to use `computeIfAbsent`.
I revised the checks with a boolean to indicate if the cache is preloaded.
--
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]