ThorneANN commented on code in PR #2791:
URL: https://github.com/apache/fluss/pull/2791#discussion_r3534838701


##########
fluss-lake/fluss-lake-paimon/src/main/java/org/apache/fluss/lake/paimon/source/PaimonRecordReader.java:
##########
@@ -75,9 +75,20 @@ public PaimonRecordReader(
         } else {
             org.apache.paimon.reader.RecordReader<InternalRow> recordReader =
                     tableRead.createReader(split.dataSplit());
-            iterator =
-                    new PaimonRecordReader.PaimonRowAsFlussRecordIterator(
-                            recordReader.toCloseableIterator(), paimonRowType);
+            org.apache.paimon.utils.CloseableIterator<InternalRow> 
closeableIterator =
+                    recordReader.toCloseableIterator();
+            try {
+                iterator =
+                        new PaimonRecordReader.PaimonRowAsFlussRecordIterator(
+                                closeableIterator, paimonRowType);
+            } catch (Throwable t) {

Review Comment:
   > Thanks for the pr. Just curious about in which case it'll throw exception 
in the constuctor
   
   Tks,in the existing code, it is actually unlikely for the constructor to 
throw an exception, but this fix ensures that the closeableIterator will not be 
leaked in case the constructor is modified in the future or an unexpected 
runtime error occurs. It is a correct defensive coding practice.



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