Skip to content

Commit

Permalink
Core: fix reading of split offsets in manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanck committed Oct 14, 2023
1 parent 2aac636 commit 11cd94f
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions core/src/main/java/org/apache/iceberg/BaseFile.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -82,9 +85,6 @@ public PartitionData copy() {
// cached schema
private transient Schema avroSchema = null;

// lazy variables
private transient volatile List<Long> splitOffsetList = null;

/** Used by Avro reflection to instantiate this class when reading manifest files. */
BaseFile(Schema avroSchema) {
this.avroSchema = avroSchema;
Expand Down Expand Up @@ -463,11 +463,7 @@ public ByteBuffer keyMetadata() {

@Override
public List<Long> splitOffsets() {
if (splitOffsetList == null && splitOffsets != null) {
this.splitOffsetList = ArrayUtil.toUnmodifiableLongList(splitOffsets);
}

return splitOffsetList;
return splitOffsets == null ? ImmutableList.of() : Longs.asList(splitOffsets);
}

long[] splitOffsetArray() {
Expand All @@ -476,7 +472,7 @@ long[] splitOffsetArray() {

@Override
public List<Integer> equalityFieldIds() {
return ArrayUtil.toIntList(equalityIds);
return equalityIds == null ? ImmutableList.of() : Ints.asList(equalityIds);
}

@Override
Expand Down

0 comments on commit 11cd94f

Please sign in to comment.