Guosmilesmile commented on code in PR #14148:
URL: https://github.com/apache/iceberg/pull/14148#discussion_r2368253560


##########
flink/v2.0/flink/src/test/java/org/apache/iceberg/flink/data/TestFlinkParquetReader.java:
##########
@@ -216,29 +223,32 @@ public void testTwoLevelList() throws IOException {
 
   private void writeAndValidate(
       Iterable<Record> iterable, Schema writeSchema, Schema expectedSchema) 
throws IOException {
-    File testFile = File.createTempFile("junit", null, temp.toFile());
-    assertThat(testFile.delete()).isTrue();
 
+    OutputFile output = new InMemoryOutputFile();
     try (FileAppender<Record> writer =
-        Parquet.write(Files.localOutput(testFile))
+        Parquet.write(output)
             .schema(writeSchema)
             .createWriterFunc(GenericParquetWriter::create)
             .build()) {
       writer.addAll(iterable);
     }
 
     try (CloseableIterable<RowData> reader =
-        Parquet.read(Files.localInput(testFile))
+        Parquet.read(output.toInputFile())
             .project(expectedSchema)
-            .createReaderFunc(type -> 
FlinkParquetReaders.buildReader(expectedSchema, type))
+            .createReaderFunc(
+                type -> FlinkParquetReaders.buildReader(expectedSchema, type, 
ID_TO_CONSTANT))
             .build()) {
-      Iterator<Record> expected = iterable.iterator();
       Iterator<RowData> rows = reader.iterator();
       LogicalType rowType = FlinkSchemaUtil.convert(writeSchema);
-      for (int i = 0; i < NUM_RECORDS; i += 1) {
+      int pos = 0;
+      for (Record record : iterable) {
         assertThat(rows).hasNext();
-        TestHelpers.assertRowData(writeSchema.asStruct(), rowType, 
expected.next(), rows.next());
+        TestHelpers.assertRowData(
+            writeSchema.asStruct(), rowType, record, rows.next(), 
ID_TO_CONSTANT, pos);
+        pos += 1;

Review Comment:
   Do it ! 



-- 
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

Reply via email to