codope commented on code in PR #7412:
URL: https://github.com/apache/hudi/pull/7412#discussion_r1044085391


##########
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:
   Good point! We should pull up the reader. I'll check other such places. 
Thanks.



-- 
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