Guosmilesmile commented on code in PR #15675:
URL: https://github.com/apache/iceberg/pull/15675#discussion_r3110868000
##########
data/src/test/java/org/apache/iceberg/data/BaseFormatModelTests.java:
##########
@@ -609,6 +690,407 @@ void
testReaderBuilderRecordsPerBatchNotSupported(FileFormat fileFormat) throws
.isInstanceOf(UnsupportedOperationException.class);
}
+ @ParameterizedTest
+ @FieldSource("FILE_FORMATS")
+ void testReadMetadataColumnFilePath(FileFormat fileFormat) throws
IOException {
+
+ DataGenerator dataGenerator = new DataGenerators.DefaultSchema();
+ Schema schema = dataGenerator.schema();
+ List<Record> genericRecords = dataGenerator.generateRecords();
+ writeGenericRecords(fileFormat, schema, genericRecords);
+
+ String filePath = "test-data-file.parquet";
+ Schema projectionSchema = new Schema(MetadataColumns.FILE_PATH);
+
+ Map<Integer, Object> idToConstant =
+ ImmutableMap.of(MetadataColumns.FILE_PATH.fieldId(), filePath);
+
+ List<Record> expected =
+ IntStream.range(0, genericRecords.size())
+ .mapToObj(
+ i ->
+ GenericRecord.create(projectionSchema)
+ .copy(MetadataColumns.FILE_PATH.name(), filePath))
+ .toList();
+
+ readAndAssertMetadataColumn(fileFormat, projectionSchema, idToConstant,
expected);
Review Comment:
Got it. Overload readAndAssertMetadataColumn keep the same pattern.
--
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]