openinx commented on a change in pull request #1882:
URL: https://github.com/apache/iceberg/pull/1882#discussion_r537980316
##########
File path:
flink/src/test/java/org/apache/iceberg/flink/source/TestFlinkInputFormat.java
##########
@@ -100,6 +100,33 @@ public void testNestedProjection() throws Exception {
assertRows(result, expected);
}
+ @Test
+ public void testBasicProjection() throws IOException {
+ Schema writeSchema = new Schema(
+ Types.NestedField.required(0, "id", Types.LongType.get()),
+ Types.NestedField.optional(1, "data", Types.StringType.get()),
+ Types.NestedField.optional(2, "time", Types.TimestampType.withZone())
+ );
+
+ Table table = catalog.createTable(TableIdentifier.of("default", "t"),
writeSchema);
+
+ List<Record> writeRecords = RandomGenericData.generate(writeSchema, 2, 0L);
+ new GenericAppenderHelper(table, fileFormat,
TEMPORARY_FOLDER).appendToTable(writeRecords);
+
+ TableSchema projectedSchema = TableSchema.builder()
+ .field("id", DataTypes.BIGINT())
+ .field("data", DataTypes.STRING())
+ .build();
+ List<Row> result =
runFormat(FlinkSource.forRowData().tableLoader(loader()).project(projectedSchema).buildFormat());
Review comment:
I'm okay about merging this patch. One thing I think we may need to do
is: it's better to extend the
[TestRowProjection](https://github.com/apache/iceberg/blob/master/flink/src/test/java/org/apache/iceberg/flink/data/TestRowProjection.java#L55)
to all file format ( parquet/orc etc), currently we only test the avro read
projections.
Maybe it similar to the spark unit tests `TestSparkReadProjection`
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]