You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hudi.apache.org by GitBox <gi...@apache.org> on 2022/12/09 01:27:18 UTC
[GitHub] [hudi] danny0405 commented on a diff in pull request #7412: [HUDI-5353] Close file readers
danny0405 commented on code in PR #7412:
URL: https://github.com/apache/hudi/pull/7412#discussion_r1043975952
##########
hudi-client/hudi-client-common/src/main/java/org/apache/hudi/table/action/commit/BaseMergeHelper.java:
##########
@@ -54,12 +55,15 @@ public abstract class BaseMergeHelper {
protected Iterator<GenericRecord> getMergingIterator(HoodieTable<?, ?, ?, ?> table,
HoodieMergeHandle<?, ?, ?, ?> mergeHandle,
Path bootstrapFilePath,
- Iterator<GenericRecord> recordIterator) throws IOException {
+ Iterator<GenericRecord> recordIterator) {
Configuration bootstrapFileConfig = new Configuration(table.getHadoopConf());
- HoodieFileReader<GenericRecord> bootstrapReader =
- HoodieFileReaderFactory.getFileReader(bootstrapFileConfig, bootstrapFilePath);
- return new MergingIterator<>(recordIterator, bootstrapReader.getRecordIterator(),
- (inputRecordPair) -> HoodieAvroUtils.stitchRecords(inputRecordPair.getLeft(), inputRecordPair.getRight(), mergeHandle.getWriterSchemaWithMetaFields()));
+ try (HoodieFileReader<GenericRecord> bootstrapReader =
+ HoodieFileReaderFactory.getFileReader(bootstrapFileConfig, bootstrapFilePath)) {
+ return new MergingIterator<>(recordIterator, bootstrapReader.getRecordIterator(),
+ (inputRecordPair) -> HoodieAvroUtils.stitchRecords(inputRecordPair.getLeft(), inputRecordPair.getRight(), mergeHandle.getWriterSchemaWithMetaFields()));
Review Comment:
Is the record iterator still valid if we close the reader already ?
--
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: commits-unsubscribe@hudi.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org