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


##########
data/src/test/java/org/apache/iceberg/data/BaseFormatModelTests.java:
##########
@@ -1662,6 +1582,66 @@ 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(20);
+    writeEngineRecords(
+        fileFormat, schema, convertToEngineRecords(genericRecords, schema), 
true /* overwrite */);
+    readAndAssertGenericRecords(fileFormat, schema, genericRecords);
+  }
+
+  @ParameterizedTest
+  @FieldSource("FILE_FORMATS")
+  void testDataWriterSet(FileFormat fileFormat) throws IOException {
+    writeAndAssertDataWriterWithConfig(
+        fileFormat,
+        (writerBuilder, format) -> 
testPropertyToSet(format).forEach(writerBuilder::set),
+        format -> assertThat(checkTestProperty(format)).isTrue());
+  }
+
+  @ParameterizedTest
+  @FieldSource("FILE_FORMATS")
+  void testDataWriterSetAll(FileFormat fileFormat) throws IOException {

Review Comment:
   I've submitted a version of the change. For Avro, I couldn't find a suitable 
approach for now, so I can only set both parameters and verify the second one 
to confirm it takes effect. For Parquet and ORC, both parameters are verified.



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