yihua commented on code in PR #13694:
URL: https://github.com/apache/hudi/pull/13694#discussion_r2272288383


##########
hudi-spark-datasource/hudi-spark-common/src/main/scala/org/apache/hudi/cdc/CDCFileGroupIterator.scala:
##########
@@ -489,24 +500,22 @@ class CDCFileGroupIterator(split: HoodieCDCFileGroupSplit,
       .withProps(readerProperties)
       .withLatestCommitTime(split.changes.last.getInstant)
       .build()
-    
CloseableIteratorListener.addListener(fileGroupReader.getClosableIterator).asScala
+    
CloseableIteratorListener.addListener(fileGroupReader.getClosableBufferedRecordIterator).asScala
   }
 
   private def loadLogFile(logFile: HoodieLogFile, instant: String): 
Iterator[BufferedRecord[InternalRow]] = {
     val partitionPath = 
FSUtils.getRelativePartitionPath(metaClient.getBasePath, 
logFile.getPath.getParent)
-    val readerContext = new 
SparkFileFormatInternalRowReaderContext(baseFileReader, Seq.empty, Seq.empty,
-      conf, metaClient.getTableConfig)
     readerContext.setLatestCommitTime(instant)
     readerContext.setHasBootstrapBaseFile(false)
     readerContext.setHasLogFiles(true)
-    readerContext.initRecordMerger(readerProperties)
     readerContext.setSchemaHandler(
       new FileGroupReaderSchemaHandler[InternalRow](readerContext, avroSchema, 
avroSchema,
         Option.empty(), metaClient.getTableConfig, readerProperties))
     val stats = new HoodieReadStats
-    val recordBuffer = new 
KeyBasedFileGroupRecordBuffer[InternalRow](readerContext, metaClient, 
readerContext.getMergeMode,
+    keyBasedFileGroupRecordBuffer.ifPresent(k => k.close())
+    keyBasedFileGroupRecordBuffer = Option.of(new 
KeyBasedFileGroupRecordBuffer[InternalRow](readerContext, metaClient, 
readerContext.getMergeMode,

Review Comment:
   I think this may be OK for now.



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

Reply via email to