danny0405 commented on code in PR #8484:
URL: https://github.com/apache/hudi/pull/8484#discussion_r1169743276
##########
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:
Is the iterator still valid when the outer reader has been closed ?
--
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]