gaborkaszab commented on code in PR #18924:
URL: https://github.com/apache/iceberg/pull/18924#discussion_r4585978383
##########
core/src/main/java/org/apache/iceberg/BaseSnapshot.java:
##########
@@ -78,6 +80,16 @@ class BaseSnapshot implements Snapshot {
manifestList != null || rootManifest != null,
"Snapshot %s must have a manifest list or a root manifest",
snapshotId);
+ Preconditions.checkArgument(
+ rootManifest == null || rootSizeInBytes != null,
+ "Root manifest size is required when root manifest is set");
+ Preconditions.checkArgument(
+ rootManifest != null || rootSizeInBytes == null,
+ "Root manifest size is not allowed if root manifest is null");
+ Preconditions.checkArgument(
+ rootSizeInBytes == null || rootSizeInBytes >= 0,
+ "Invalid root manifest size (cannot be negative): %s",
+ rootSizeInBytes);
Review Comment:
Keeping them separate has the advantage of giving more precise error message.
Might be relevant that in AGENTS.md we also say `Separate Preconditions
calls for each condition.`
WDYT @stevenzwu ?
--
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]