voonhous commented on code in PR #18837:
URL: https://github.com/apache/hudi/pull/18837#discussion_r3480422576


##########
hudi-trino/src/main/java/io/trino/plugin/hudi/HudiPageSource.java:
##########
@@ -115,8 +132,14 @@ public long getMemoryUsage()
     public void close()
             throws IOException
     {
-        fileGroupReader.close();
-        pageSource.close();
+        // recordIterator is the outermost wrapper: CloseableMappingIterator ->
+        // HoodieFileGroupReaderIterator -> fileGroupReader.close() -> 
baseFileIterator.close()
+        // (which closes the Trino pageSource) + recordBuffer.close(). Closing 
it alone therefore
+        // releases every underlying resource exactly once; also registering 
fileGroupReader/
+        // pageSource would re-close the same handles, since close() does not 
null its fields.
+        try (Closer closer = Closer.create()) {

Review Comment:
   Done. Switched to a direct `recordIterator.close()` and trimmed the comment 
down.



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