diff --git a/paimon-common/src/main/java/org/apache/paimon/reader/RecordReaderIterator.java b/paimon-common/src/main/java/org/apache/paimon/reader/RecordReaderIterator.java index 5a807c6f115c..98a485a9cde6 100644 --- a/paimon-common/src/main/java/org/apache/paimon/reader/RecordReaderIterator.java +++ b/paimon-common/src/main/java/org/apache/paimon/reader/RecordReaderIterator.java @@ -19,6 +19,7 @@ package org.apache.paimon.reader; import org.apache.paimon.utils.CloseableIterator; +import org.apache.paimon.utils.IOUtils; import java.io.IOException; @@ -34,7 +35,8 @@ public RecordReaderIterator(RecordReader reader) { this.reader = reader; try { this.currentIterator = reader.readBatch(); - } catch (IOException e) { + } catch (Exception e) { + IOUtils.closeQuietly(reader); throw new RuntimeException(e); } this.advanced = false;