From 11cd94f95c22f3b335b5de92e4dc31392f3c5e8f Mon Sep 17 00:00:00 2001 From: Bryan Keller Date: Sat, 14 Oct 2023 12:50:08 -0700 Subject: [PATCH] Core: fix reading of split offsets in manifests --- .../src/main/java/org/apache/iceberg/BaseFile.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/core/src/main/java/org/apache/iceberg/BaseFile.java b/core/src/main/java/org/apache/iceberg/BaseFile.java index aa05275c0af8..87ca6f110197 100644 --- a/core/src/main/java/org/apache/iceberg/BaseFile.java +++ b/core/src/main/java/org/apache/iceberg/BaseFile.java @@ -30,7 +30,10 @@ import org.apache.avro.specific.SpecificData; import org.apache.iceberg.avro.AvroSchemaUtil; import org.apache.iceberg.relocated.com.google.common.base.MoreObjects; +import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList; import org.apache.iceberg.relocated.com.google.common.collect.Lists; +import org.apache.iceberg.relocated.com.google.common.primitives.Ints; +import org.apache.iceberg.relocated.com.google.common.primitives.Longs; import org.apache.iceberg.types.Type; import org.apache.iceberg.types.Types; import org.apache.iceberg.util.ArrayUtil; @@ -82,9 +85,6 @@ public PartitionData copy() { // cached schema private transient Schema avroSchema = null; - // lazy variables - private transient volatile List splitOffsetList = null; - /** Used by Avro reflection to instantiate this class when reading manifest files. */ BaseFile(Schema avroSchema) { this.avroSchema = avroSchema; @@ -463,11 +463,7 @@ public ByteBuffer keyMetadata() { @Override public List splitOffsets() { - if (splitOffsetList == null && splitOffsets != null) { - this.splitOffsetList = ArrayUtil.toUnmodifiableLongList(splitOffsets); - } - - return splitOffsetList; + return splitOffsets == null ? ImmutableList.of() : Longs.asList(splitOffsets); } long[] splitOffsetArray() { @@ -476,7 +472,7 @@ long[] splitOffsetArray() { @Override public List equalityFieldIds() { - return ArrayUtil.toIntList(equalityIds); + return equalityIds == null ? ImmutableList.of() : Ints.asList(equalityIds); } @Override