danny0405 commented on a change in pull request #4909:
URL: https://github.com/apache/hudi/pull/4909#discussion_r816572284



##########
File path: 
hudi-common/src/main/java/org/apache/hudi/io/storage/HoodieHFileReader.java
##########
@@ -227,6 +261,40 @@ public BloomFilter readBloomFilter() {
     return records;
   }
 
+  public ClosableIterator<R> getRecordIterator(List<String> keys, Schema 
schema) throws IOException {
+    this.schema = schema;
+    reader.loadFileInfo();
+    Iterator<String> iterator = keys.iterator();
+    return new ClosableIterator<R>() {
+      private R next;
+      @Override
+      public void close() {
+        HoodieHFileReader.this.close();
+      }

Review comment:
       I think we should not close the file reader in the iterator, which make 
the reader can not be read anymore. The fetch of iterator should not have side 
effect except that we are sure the reader was only used for fetching the 
iterator then(still risky, we should only release the resource that belongs 
only to the iterator).




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