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-unsubscr...@hudi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to