gszadovszky commented on code in PR #3351:
URL: https://github.com/apache/parquet-java/pull/3351#discussion_r2480183549


##########
parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileWriter.java:
##########
@@ -335,6 +336,34 @@ public ParquetFileWriter(OutputFile file, MessageType 
schema, Mode mode, long ro
         ParquetProperties.DEFAULT_PAGE_WRITE_CHECKSUM_ENABLED);
   }
 
+  @FunctionalInterface
+  interface IOCallable<T> {
+    T call() throws IOException;
+  }
+
+  private <T> T withAbortOnFailure(IOCallable<T> action) throws IOException {
+    try {
+      return action.call();
+    } catch (IOException e) {
+      aborted = true;
+      throw e;
+    }
+  }
+
+  @FunctionalInterface
+  interface IORunnable {
+    void run() throws IOException;
+  }
+
+  private void withAbortOnFailure(IORunnable action) throws IOException {
+    try {
+      action.run();
+    } catch (IOException e) {
+      aborted = true;
+      throw e;
+    }
+  }
+

Review Comment:
   Maybe, you could move these to a specific utility. At least the functional 
interfaces. But, with an additional "abort action" in the parameter, even the 
withAbort functions as well.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to