mxm commented on code in PR #12049: URL: https://github.com/apache/iceberg/pull/12049#discussion_r1937932293
########## data/src/test/java/org/apache/iceberg/data/DataTest.java: ########## @@ -486,4 +490,20 @@ public void testPrimitiveTypeDefaultValues(Type.PrimitiveType type, Object defau writeAndValidate(writeSchema, readSchema); } + + @Test + public void testWriteNullValueForRequiredType() { + Schema schema = + new Schema( + required(0, "id", LongType.get()), required(1, "string", Types.StringType.get())); + + GenericRecord genericRecord = GenericRecord.create(schema); + genericRecord.set(0, 42L); + genericRecord.set(1, null); + + Assertions.assertThrows( + // The actual exception depends on the implementation, e.g. + // NullPointerException or IllegalArgumentException. + Exception.class, () -> writeAndValidate(schema, List.of(genericRecord))); Review Comment: There are a couple of instances, but point taken. ########## data/src/test/java/org/apache/iceberg/data/orc/TestGenericData.java: ########## @@ -237,4 +243,10 @@ private void writeAndValidateRecords(Schema schema, List<Record> expected) throw DataTestHelpers.assertEquals(schema.asStruct(), expected.get(i), rows.get(i)); } } + + @Override + @Ignore("ORC file format supports null values even for required fields") Review Comment: Fair point. Changed. -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org