pvary commented on code in PR #16015:
URL: https://github.com/apache/iceberg/pull/16015#discussion_r3340564144


##########
flink/v2.1/flink/src/test/java/org/apache/iceberg/flink/sink/dynamic/TestDynamicWriter.java:
##########
@@ -361,6 +398,61 @@ private static int getNumDataFiles(Table table) {
     return 0;
   }
 
+  private static void replaceTaskWriters(DynamicWriter dynamicWriter, 
TaskWriter<RowData> fake) {
+    DynFields.BoundField<Map<WriteTarget, TaskWriter<RowData>>> writersField =
+        DynFields.builder().hiddenImpl(DynamicWriter.class, 
"writers").build(dynamicWriter);
+    writersField.get().replaceAll((target, writer) -> fake);
+  }
+
+  private static class FailingTaskWriter implements TaskWriter<RowData> {
+    private final IOException exception;
+
+    FailingTaskWriter(IOException exception) {
+      this.exception = exception;
+    }
+
+    @Override
+    public void write(RowData row) {}
+
+    @Override
+    public void abort() {}
+
+    @Override
+    public WriteResult complete() throws IOException {
+      throw exception;
+    }
+
+    @Override
+    public void close() {}
+  }
+
+  private static class BarrierTaskWriter implements TaskWriter<RowData> {
+    private final CyclicBarrier barrier;
+
+    BarrierTaskWriter(CyclicBarrier barrier) {
+      this.barrier = barrier;
+    }
+
+    @Override
+    public void write(RowData row) {}
+
+    @Override
+    public void abort() {}
+
+    @Override
+    public WriteResult complete() throws IOException {
+      try {
+        barrier.await(5, TimeUnit.SECONDS);
+      } catch (Exception e) {
+        throw new IOException(e);
+      }
+      return WriteResult.builder().build();

Review Comment:
   nit: newline



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