Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apache/iceberg
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 772f5c2ff451d99d1a64b54d7fd83e59d4d2774f
Choose a base ref
..
head repository: apache/iceberg
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 233a00b48c382108d0179c26fc33517ec238e4c7
Choose a head ref
Showing with 6 additions and 4 deletions.
  1. +6 −4 parquet/src/test/java/org/apache/iceberg/parquet/TestInternalWriter.java
Original file line number Diff line number Diff line change
@@ -26,6 +26,7 @@
import java.io.IOException;
import java.nio.ByteBuffer;
import java.nio.file.Path;
import java.util.Comparator;
import java.util.List;
import java.util.UUID;
import org.apache.iceberg.DataFile;
@@ -36,14 +37,14 @@
import org.apache.iceberg.Schema;
import org.apache.iceberg.StructLike;
import org.apache.iceberg.data.GenericRecord;
import org.apache.iceberg.data.Record;
import org.apache.iceberg.data.parquet.InternalReader;
import org.apache.iceberg.data.parquet.InternalWriter;
import org.apache.iceberg.expressions.Literal;
import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.io.DataWriter;
import org.apache.iceberg.io.OutputFile;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.iceberg.types.Comparators;
import org.apache.iceberg.types.Types;
import org.apache.iceberg.util.StructProjection;
import org.junit.jupiter.api.Test;
@@ -118,15 +119,16 @@ public void testDataWriter() throws IOException {
assertThat(dataFile.partition().size()).as("Partition should be empty").isEqualTo(0);
assertThat(dataFile.keyMetadata()).as("Key metadata should be null").isNull();

List<Record> writtenRecords;
try (CloseableIterable<Record> reader =
List<StructLike> writtenRecords;
try (CloseableIterable<StructLike> reader =
Parquet.read(file.toInputFile())
.project(schema)
.createReaderFunc(fileSchema -> InternalReader.buildReader(schema, fileSchema))
.build()) {
writtenRecords = Lists.newArrayList(reader);
}
assertThat(writtenRecords).hasSize(1);
assertThat(writtenRecords.get(0)).isEqualTo(record);
Comparator<StructLike> structLikeComparator = Comparators.forType(schema.asStruct());
assertThat(structLikeComparator.compare(writtenRecords.get(0), row)).isZero();
}
}