RussellSpitzer commented on code in PR #4687:
URL: https://github.com/apache/iceberg/pull/4687#discussion_r867179215


##########
spark/v3.2/spark/src/test/java/org/apache/iceberg/spark/source/TestSparkDataWrite.java:
##########
@@ -588,6 +600,56 @@ public void 
partitionedCreateWithTargetFileSizeViaOption(IcebergOptionsType opti
     Assert.assertTrue("All DataFiles contain 1000 rows", 
files.stream().allMatch(d -> d.recordCount() == 1000));
   }
 
+  @Test
+  public void testCommitUnknownException() throws IOException {
+    File parent = temp.newFolder(format.toString());
+    File location = new File(parent, "commitunknown");
+
+    HadoopTables tables = new HadoopTables(CONF);
+    PartitionSpec spec = 
PartitionSpec.builderFor(SCHEMA).identity("data").build();
+    Table table = tables.create(SCHEMA, spec, location.toString());
+
+    List<SimpleRecord> records = Lists.newArrayList(
+        new SimpleRecord(1, "a"),
+        new SimpleRecord(2, "b"),
+        new SimpleRecord(3, "c")
+    );
+
+    Dataset<Row> df = spark.createDataFrame(records, SimpleRecord.class);
+
+    AppendFiles append = table.newFastAppend();
+    AppendFiles spyAppend = spy(append);
+    doAnswer(invocation -> {
+      append.commit();
+      throw new CommitStateUnknownException(new RuntimeException("Datacenter 
on Fire"));
+    }).when(spyAppend).commit();
+
+    Table spyTable = spy(table);

Review Comment:
   We need a spy Table here so we can have it return our Spy Append



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