You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by "smaheshwar-pltr (via GitHub)" <gi...@apache.org> on 2025/02/01 20:11:29 UTC
[PR] Core: Delegate `resetMainBranch` to `removeRef` in `TableMetadata::Builder` [iceberg]
smaheshwar-pltr opened a new pull request, #12149:
URL: https://github.com/apache/iceberg/pull/12149
Tiny change to prefer delegation to duplication as https://github.com/apache/iceberg/issues/11109 suggests that keeping these method bodies separate can be risky.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Delegate `resetMainBranch` to `removeRef` in `TableMetadata::Builder` [iceberg]
Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar commented on code in PR #12149:
URL: https://github.com/apache/iceberg/pull/12149#discussion_r1939597352
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1310,13 +1310,7 @@ public Builder removeRef(String name) {
}
private Builder resetMainBranch() {
- this.currentSnapshotId = -1;
- SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH);
- if (ref != null) {
- changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH));
- }
-
- return this;
+ return removeRef(SnapshotRef.MAIN_BRANCH);
Review Comment:
Good find, yes I don't see a good reason to keep `resetMainBranch` around anymore especially since it's a private method. let's just remove it!
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Remove `TableMetadata::Builder::resetMainBranch` [iceberg]
Posted by "smaheshwar-pltr (via GitHub)" <gi...@apache.org>.
smaheshwar-pltr commented on code in PR #12149:
URL: https://github.com/apache/iceberg/pull/12149#discussion_r1939621553
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1310,13 +1310,7 @@ public Builder removeRef(String name) {
}
private Builder resetMainBranch() {
- this.currentSnapshotId = -1;
- SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH);
- if (ref != null) {
- changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH));
- }
-
- return this;
+ return removeRef(SnapshotRef.MAIN_BRANCH);
Review Comment:
Done! https://github.com/apache/iceberg/pull/12149/commits/d753324b3031c25bfcb9de3c46be578766008b19
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Remove `TableMetadata::Builder::resetMainBranch` [iceberg]
Posted by "amogh-jahagirdar (via GitHub)" <gi...@apache.org>.
amogh-jahagirdar merged PR #12149:
URL: https://github.com/apache/iceberg/pull/12149
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Delegate `resetMainBranch` to `removeRef` in `TableMetadata::Builder` [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #12149:
URL: https://github.com/apache/iceberg/pull/12149#discussion_r1938612158
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1310,13 +1310,7 @@ public Builder removeRef(String name) {
}
private Builder resetMainBranch() {
- this.currentSnapshotId = -1;
- SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH);
- if (ref != null) {
- changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH));
- }
-
- return this;
+ return removeRef(SnapshotRef.MAIN_BRANCH);
Review Comment:
I think we can remove `resetMainBranch` method now. The logic between `removeRef(SnapshotRef.MAIN_BRANCH)` and `resetMainBranch()` were different until #11779. They are same now.
cc: @amogh-jahagirdar
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1310,13 +1310,7 @@ public Builder removeRef(String name) {
}
private Builder resetMainBranch() {
- this.currentSnapshotId = -1;
- SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH);
- if (ref != null) {
- changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH));
- }
-
- return this;
+ return removeRef(SnapshotRef.MAIN_BRANCH);
Review Comment:
We could remove `resetMainBranch` method. The logic between `removeRef(SnapshotRef.MAIN_BRANCH)` and `resetMainBranch()` were different until #11779. They are same now.
cc: @amogh-jahagirdar
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Delegate `resetMainBranch` to `removeRef` in `TableMetadata::Builder` [iceberg]
Posted by "smaheshwar-pltr (via GitHub)" <gi...@apache.org>.
smaheshwar-pltr commented on code in PR #12149:
URL: https://github.com/apache/iceberg/pull/12149#discussion_r1938644937
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1310,13 +1310,7 @@ public Builder removeRef(String name) {
}
private Builder resetMainBranch() {
- this.currentSnapshotId = -1;
- SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH);
- if (ref != null) {
- changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH));
- }
-
- return this;
+ return removeRef(SnapshotRef.MAIN_BRANCH);
Review Comment:
Yes - happy to make this change
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org
Re: [PR] Core: Delegate `resetMainBranch` to `removeRef` in `TableMetadata::Builder` [iceberg]
Posted by "ebyhr (via GitHub)" <gi...@apache.org>.
ebyhr commented on code in PR #12149:
URL: https://github.com/apache/iceberg/pull/12149#discussion_r1938612158
##########
core/src/main/java/org/apache/iceberg/TableMetadata.java:
##########
@@ -1310,13 +1310,7 @@ public Builder removeRef(String name) {
}
private Builder resetMainBranch() {
- this.currentSnapshotId = -1;
- SnapshotRef ref = refs.remove(SnapshotRef.MAIN_BRANCH);
- if (ref != null) {
- changes.add(new MetadataUpdate.RemoveSnapshotRef(SnapshotRef.MAIN_BRANCH));
- }
-
- return this;
+ return removeRef(SnapshotRef.MAIN_BRANCH);
Review Comment:
I think we can remove `resetMainBranch` method now.
The logic between `removeRef(SnapshotRef.MAIN_BRANCH)` and `resetMainBranch()` were different until #11779.
--
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: issues-unsubscribe@iceberg.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org