rdblue commented on code in PR #16408:
URL: https://github.com/apache/iceberg/pull/16408#discussion_r3284934435
##########
core/src/main/java/org/apache/iceberg/TrackingStruct.java:
##########
@@ -268,67 +286,67 @@ public String toString() {
}
static class Builder {
- private EntryStatus status = null;
- private Long snapshotId = null;
- private Long dataSequenceNumber = null;
- private Long fileSequenceNumber = null;
- private Long dvSnapshotId = null;
- private Long firstRowId = null;
- private byte[] deletedPositions = null;
- private byte[] replacedPositions = null;
-
- Builder status(EntryStatus entryStatus) {
- this.status = entryStatus;
- return this;
- }
-
- Builder snapshotId(Long id) {
- this.snapshotId = id;
- return this;
- }
-
- Builder dataSequenceNumber(Long sequenceNumber) {
- this.dataSequenceNumber = sequenceNumber;
- return this;
+ private final EntryStatus status;
+ private final Long snapshotId;
+ private final Long dataSequenceNumber;
+ private final Long fileSequenceNumber;
+ private final Long firstRowId;
+ private Long dvSnapshotId;
+ private byte[] deletedPositions;
+ private byte[] replacedPositions;
+
+ private Builder(EntryStatus status, long snapshotId) {
+ this.status = status;
+ this.snapshotId = snapshotId;
+ this.dataSequenceNumber = null;
+ this.fileSequenceNumber = null;
+ this.firstRowId = null;
}
- Builder fileSequenceNumber(Long sequenceNumber) {
- this.fileSequenceNumber = sequenceNumber;
- return this;
+ private Builder(EntryStatus status, Tracking source, Long snapshotId) {
Review Comment:
`snapshotId` is not allowed to be passed for `EXISTING` or `MODIFIED`
because those inherit the snapshot ID from `source`. That means we should add
another constructor for this case. I know that the current `existing(...)`
method passes `source.snapshotId()`, but that moves logic from the builder into
the builder factory methods. I would prefer to keep it all in the builder.
I don't have a preference for whether the new constructor calls this after
verifying `status` or if it is a different constructor.
--
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]