huaxingao commented on code in PR #13450:
URL: https://github.com/apache/iceberg/pull/13450#discussion_r2245847315
##########
spark/v4.0/spark/src/test/java/org/apache/iceberg/spark/data/vectorized/parquet/TestParquetVectorizedReads.java:
##########
@@ -416,4 +439,61 @@ public void testUuidReads() throws Exception {
}
assertRecordsMatch(schema, numRows, data, dataFile, false, BATCH_SIZE);
}
+
+ private void assertIdenticalFileContents(File actual, File expected, Schema
schema)
+ throws IOException {
+ try (CloseableIterable<InternalRow> actualReader =
+ Parquet.read(Files.localInput(actual))
+ .project(schema)
+ .createReaderFunc(t -> SparkParquetReaders.buildReader(schema, t,
ID_TO_CONSTANT))
+ .build()) {
+ Iterator<InternalRow> actualIterator = actualReader.iterator();
+ try (CloseableIterable<InternalRow> plainReader =
+ Parquet.read(Files.localInput(expected))
+ .project(schema)
+ .createReaderFunc(t -> SparkParquetReaders.buildReader(schema,
t, ID_TO_CONSTANT))
+ .build()) {
+ Iterator<InternalRow> expectedIterator = plainReader.iterator();
+
+ List<InternalRow> expectedList = Lists.newArrayList();
+ expectedIterator.forEachRemaining(expectedList::add);
+ List<InternalRow> actualList = Lists.newArrayList();
+ actualIterator.forEachRemaining(actualList::add);
+
+ assertThat(actualList).isNotEmpty();
+ assertThat(actualList).hasSameSizeAs(expectedList);
+ assertThat(actualList).hasSameElementsAs(expectedList);
+ }
+ }
+ }
+
+ static Stream<Arguments> goldenFilesAndEncodings() {
+ return GOLDEN_FILE_ENCODINGS.stream()
+ .flatMap(
+ encoding ->
+ GOLDEN_FILE_TYPES.entrySet().stream()
+ .map(
+ typeEntry ->
+ Arguments.of(encoding, typeEntry.getKey(),
typeEntry.getValue())));
+ }
+
+ @ParameterizedTest
+ @MethodSource("goldenFilesAndEncodings")
+ public void testGoldenFiles(
+ String encoding, String typeName,
org.apache.iceberg.types.Type.PrimitiveType primitiveType)
Review Comment:
nit: shall we import `org.apache.iceberg.types.Type.PrimitiveType`?
--
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]