Skip to content

Commit 2bcd2bd

Browse files
GH-3350: Avoid flushing data to cloud when exception is thrown (#3351)
1 parent 44701aa commit 2bcd2bd

File tree

3 files changed

+517
-392
lines changed

3 files changed

+517
-392
lines changed

parquet-hadoop/src/main/java/org/apache/parquet/hadoop/InternalParquetRecordWriter.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,7 @@ public void close() throws IOException, InterruptedException {
129129
if (!closed) {
130130
try {
131131
if (aborted) {
132+
parquetFileWriter.abort();
132133
return;
133134
}
134135
flushRowGroupToStore();
@@ -140,6 +141,9 @@ public void close() throws IOException, InterruptedException {
140141
}
141142
finalMetadata.putAll(finalWriteContext.getExtraMetaData());
142143
parquetFileWriter.end(finalMetadata);
144+
} catch (Exception e) {
145+
parquetFileWriter.abort();
146+
throw e;
143147
} finally {
144148
AutoCloseables.uncheckedClose(columnStore, pageStore, bloomFilterWriteStore, parquetFileWriter);
145149
closed = true;

0 commit comments

Comments
 (0)