mxm commented on code in PR #12049: URL: https://github.com/apache/iceberg/pull/12049#discussion_r1937932845
########## flink/v1.20/flink/src/test/java/org/apache/iceberg/flink/sink/TestIcebergSink.java: ########## @@ -414,6 +422,49 @@ void testOperatorsUidNameWitUidSuffix() throws Exception { assertThat(secondTransformation.getName()).isEqualTo("data-ingestion"); } + @TestTemplate + void testErrorOnNullForRequiredField() throws Exception { + Assumptions.assumeFalse( + format == FileFormat.ORC, "ORC file format supports null values even for required fields."); + + Schema icebergSchema = + new Schema( + Types.NestedField.required(1, "id2", Types.IntegerType.get()), + Types.NestedField.required(2, "data2", Types.StringType.get())); + Table table2 = + CATALOG_EXTENSION + .catalog() + .createTable( + TableIdentifier.of(DATABASE, "t2"), + icebergSchema, + PartitionSpec.unpartitioned(), + ImmutableMap.of(TableProperties.DEFAULT_FILE_FORMAT, format.name())); + + // Null out a required field + List<Row> rows = List.of(Row.of(42, null)); + + env = StreamExecutionEnvironment.getExecutionEnvironment(); + + DataStream<Row> dataStream = + env.addSource(createBoundedSource(rows), ROW_TYPE_INFO).uid("mySourceId"); + + TableSchema flinkSchema = FlinkSchemaUtil.toSchema(icebergSchema); + IcebergSink.forRow(dataStream, flinkSchema) + .table(table2) + .tableLoader(tableLoader) Review Comment: Good catch, although not central to the test logic. 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