prashantwason commented on code in PR #8484:
URL: https://github.com/apache/hudi/pull/8484#discussion_r1172149905
##########
hudi-common/src/main/java/org/apache/hudi/common/table/log/block/HoodieHFileDataBlock.java:
##########
@@ -195,14 +193,16 @@ protected <T> ClosableIterator<HoodieRecord<T>>
lookupRecords(List<String> keys,
List<String> sortedKeys = new ArrayList<>(keys);
Collections.sort(sortedKeys);
- final HoodieAvroHFileReader reader =
- new HoodieAvroHFileReader(inlineConf, inlinePath, new
CacheConfig(inlineConf), inlinePath.getFileSystem(inlineConf));
+ try (HoodieAvroHFileReader reader =
+ new HoodieAvroHFileReader(inlineConf, inlinePath, new
CacheConfig(inlineConf), inlinePath.getFileSystem(inlineConf),
+ Option.of(getSchemaFromHeader()))) {
- // Get writer's schema from the header
- final ClosableIterator<HoodieRecord<IndexedRecord>> recordIterator =
- fullKey ? reader.getRecordsByKeysIterator(sortedKeys, readerSchema) :
reader.getRecordsByKeyPrefixIterator(sortedKeys, readerSchema);
+ // Get writer's schema from the header
+ final ClosableIterator<HoodieRecord<IndexedRecord>> recordIterator =
+ fullKey ? reader.getRecordsByKeysIterator(sortedKeys, readerSchema)
: reader.getRecordsByKeyPrefixIterator(sortedKeys, readerSchema);
- return new CloseableMappingIterator<>(recordIterator, data ->
(HoodieRecord<T>) data);
+ return new CloseableMappingIterator<>(recordIterator, data ->
(HoodieRecord<T>) data);
+ }
Review Comment:
Probably not. I will backup these changes which introduce try block.
I think the intention is to return an iterator which will close the reader
after iteration (hence the name ClosableIterator).
--
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]