Guosmilesmile commented on code in PR #16575:
URL: https://github.com/apache/iceberg/pull/16575#discussion_r3315521440


##########
data/src/test/java/org/apache/iceberg/data/BaseFormatModelTests.java:
##########
@@ -1662,6 +1598,69 @@ void 
testReadFileWithoutFieldIdsUsingNameMapping(FileFormat fileFormat) throws I
     assertEquals(icebergSchema, convertToEngineRecords(genericRecords, 
icebergSchema), readRecords);
   }
 
+  @ParameterizedTest
+  @FieldSource("FILE_FORMATS")
+  void testDataWriterOverwrite(FileFormat fileFormat) throws IOException {
+    DataGenerator dataGenerator = new DataGenerators.DefaultSchema();
+    Schema schema = dataGenerator.schema();
+
+    List<Record> genericRecords = dataGenerator.generateRecords();
+    List<T> engineRecords = convertToEngineRecords(genericRecords, schema);
+
+    writeEngineRecords(fileFormat, schema, engineRecords);
+    readAndAssertGenericRecords(fileFormat, schema, genericRecords);
+
+    assertThatThrownBy(() -> writeEngineRecords(fileFormat, schema, 
engineRecords))
+        .isInstanceOf(AlreadyExistsException.class)
+        .hasMessageContaining("Already exists");
+
+    genericRecords = dataGenerator.generateRecords();

Review Comment:
   Yes, you are right. My original intent was to use different data, but I 
didn't realize I was using the same seed. This time I'm generating a different 
number of records to produce different data.



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