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


##########
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 tried this, but for Avro there are only two relevant properties: 
write.avro.compression-codec and write.avro.compression-level. Unlike the 
codec, the compression-level is not exposed in the metadata or file info, so I 
have no way to read it back for now. Parquet and Orc seem can find second 
property. 
   
   Should we make further changes here?



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