nastra commented on a change in pull request #3580:
URL: https://github.com/apache/iceberg/pull/3580#discussion_r753207052



##########
File path: core/src/main/java/org/apache/iceberg/TableMetadata.java
##########
@@ -217,90 +228,19 @@ public String toString() {
     }
   }
 
-  private final transient InputFile file;
-
-  // stored metadata
-  private final String metadataFileLocation;
-  private final int formatVersion;
-  private final String uuid;
-  private final String location;
-  private final long lastSequenceNumber;
-  private final long lastUpdatedMillis;
-  private final int lastColumnId;
-  private final int currentSchemaId;
-  private final List<Schema> schemas;
-  private final int defaultSpecId;
-  private final List<PartitionSpec> specs;
-  private final int lastAssignedPartitionId;
-  private final int defaultSortOrderId;
-  private final List<SortOrder> sortOrders;
-  private final Map<String, String> properties;
-  private final long currentSnapshotId;
-  private final List<Snapshot> snapshots;
-  private final Map<Long, Snapshot> snapshotsById;
-  private final Map<Integer, Schema> schemasById;
-  private final Map<Integer, PartitionSpec> specsById;
-  private final Map<Integer, SortOrder> sortOrdersById;
-  private final List<HistoryEntry> snapshotLog;
-  private final List<MetadataLogEntry> previousFiles;
-
-  @SuppressWarnings("checkstyle:CyclomaticComplexity")
-  TableMetadata(InputFile file,
-                int formatVersion,
-                String uuid,
-                String location,
-                long lastSequenceNumber,
-                long lastUpdatedMillis,
-                int lastColumnId,
-                int currentSchemaId,
-                List<Schema> schemas,
-                int defaultSpecId,
-                List<PartitionSpec> specs,
-                int lastAssignedPartitionId,
-                int defaultSortOrderId,
-                List<SortOrder> sortOrders,
-                Map<String, String> properties,
-                long currentSnapshotId,
-                List<Snapshot> snapshots,
-                List<HistoryEntry> snapshotLog,
-                List<MetadataLogEntry> previousFiles) {
-    Preconditions.checkArgument(specs != null && !specs.isEmpty(), "Partition 
specs cannot be null or empty");
-    Preconditions.checkArgument(sortOrders != null && !sortOrders.isEmpty(), 
"Sort orders cannot be null or empty");
-    Preconditions.checkArgument(formatVersion <= 
SUPPORTED_TABLE_FORMAT_VERSION,
-        "Unsupported format version: v%s", formatVersion);
-    Preconditions.checkArgument(formatVersion == 1 || uuid != null,
-        "UUID is required in format v%s", formatVersion);
-    Preconditions.checkArgument(formatVersion > 1 || lastSequenceNumber == 0,
-        "Sequence number must be 0 in v1: %s", lastSequenceNumber);
-
-    this.formatVersion = formatVersion;
-    this.file = file;
-    this.metadataFileLocation = file != null ? file.location() : null;
-    this.uuid = uuid;
-    this.location = location;
-    this.lastSequenceNumber = lastSequenceNumber;
-    this.lastUpdatedMillis = lastUpdatedMillis;
-    this.lastColumnId = lastColumnId;
-    this.currentSchemaId = currentSchemaId;
-    this.schemas = schemas;
-    this.specs = specs;
-    this.defaultSpecId = defaultSpecId;
-    this.lastAssignedPartitionId = lastAssignedPartitionId;
-    this.defaultSortOrderId = defaultSortOrderId;
-    this.sortOrders = sortOrders;
-    this.properties = properties;
-    this.currentSnapshotId = currentSnapshotId;
-    this.snapshots = snapshots;
-    this.snapshotLog = snapshotLog;
-    this.previousFiles = previousFiles;
-
-    this.snapshotsById = indexAndValidateSnapshots(snapshots, 
lastSequenceNumber);
-    this.schemasById = indexSchemas();
-    this.specsById = indexSpecs(specs);
-    this.sortOrdersById = indexSortOrders(sortOrders);
+  @Value.Check
+  protected void check() {
+    Preconditions.checkArgument(specs() != null && !specs().isEmpty(), 
"Partition specs cannot be null or empty");

Review comment:
       I left these checks untouched, but these fields cannot be null, since 
they don't have a `Nullable` annotation and the Immutables lib will throw an 
error if a these fields receive a `null` value




-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to