in core/src/main/java/org/apache/iceberg/V3Metadata.java [88:163]
private Object get(int pos) {
switch (pos) {
case 0:
return wrapped.path();
case 1:
return wrapped.length();
case 2:
return wrapped.partitionSpecId();
case 3:
return wrapped.content().id();
case 4:
if (wrapped.sequenceNumber() == ManifestWriter.UNASSIGNED_SEQ) {
// if the sequence number is being assigned here, then the manifest must be created by
// the current
// operation. to validate this, check that the snapshot id matches the current commit
Preconditions.checkState(
commitSnapshotId == wrapped.snapshotId(),
"Found unassigned sequence number for a manifest from snapshot: %s",
wrapped.snapshotId());
return sequenceNumber;
} else {
return wrapped.sequenceNumber();
}
case 5:
if (wrapped.minSequenceNumber() == ManifestWriter.UNASSIGNED_SEQ) {
// same sanity check as above
Preconditions.checkState(
commitSnapshotId == wrapped.snapshotId(),
"Found unassigned sequence number for a manifest from snapshot: %s",
wrapped.snapshotId());
// if the min sequence number is not determined, then there was no assigned sequence
// number for any file
// written to the wrapped manifest. replace the unassigned sequence number with the one
// for this commit
return sequenceNumber;
} else {
return wrapped.minSequenceNumber();
}
case 6:
return wrapped.snapshotId();
case 7:
return wrapped.addedFilesCount();
case 8:
return wrapped.existingFilesCount();
case 9:
return wrapped.deletedFilesCount();
case 10:
return wrapped.addedRowsCount();
case 11:
return wrapped.existingRowsCount();
case 12:
return wrapped.deletedRowsCount();
case 13:
return wrapped.partitions();
case 14:
return wrapped.keyMetadata();
case 15:
if (wrappedFirstRowId != null) {
// if first-row-id is assigned, ensure that it is valid
Preconditions.checkState(
wrapped.content() == ManifestContent.DATA && wrapped.firstRowId() == null,
"Found invalid first-row-id assignment: %s",
wrapped);
return wrappedFirstRowId;
} else if (wrapped.content() != ManifestContent.DATA) {
return null;
} else {
Preconditions.checkState(
wrapped.firstRowId() != null,
"Found unassigned first-row-id for file: " + wrapped.path());
return wrapped.firstRowId();
}
default:
throw new UnsupportedOperationException("Unknown field ordinal: " + pos);
}
}