Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .palantir/revapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ acceptedBreaks:
- code: "java.method.addedToInterface"
new: "method ThisT org.apache.iceberg.SnapshotUpdate<ThisT>::scanManifestsWith(java.util.concurrent.ExecutorService)"
justification: "Accept all changes prior to introducing API compatibility checks"
- code: "java.method.addedToInterface"
new: "method ThisT org.apache.iceberg.SnapshotUpdate<ThisT>::toBranch(java.lang.String)"
justification: "Adding toBranch API for supporting committing to a branch"
- code: "java.method.addedToInterface"
new: "method boolean org.apache.iceberg.expressions.BoundTerm<T>::isEquivalentTo(org.apache.iceberg.expressions.BoundTerm<?>)"
justification: "new API method"
Expand Down
7 changes: 6 additions & 1 deletion api/src/main/java/org/apache/iceberg/SnapshotUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -65,5 +65,10 @@ public interface SnapshotUpdate<ThisT> extends PendingUpdate<Snapshot> {
*
* @param branch which is name of SnapshotRef of type branch.
*/
ThisT toBranch(String branch);
default ThisT toBranch(String branch) {
throw new UnsupportedOperationException(
String.format(
"Cannot commit to branch %s: %s does not support branch commits",
branch, this.getClass().getName()));
}
}
12 changes: 2 additions & 10 deletions core/src/main/java/org/apache/iceberg/SnapshotProducer.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,6 @@ public ThisT scanManifestsWith(ExecutorService executorService) {
return self();
}

@Override
public ThisT toBranch(String branch) {
throw new UnsupportedOperationException(
String.format(
"Cannot commit to branch %s: %s does not support branch commits",
branch, this.getClass().getName()));
}

/**
* * A setter for the target branch on which snapshot producer operation should be performed
*
Expand Down Expand Up @@ -178,10 +170,10 @@ public ThisT deleteWith(Consumer<String> deleteCallback) {
protected void validate(TableMetadata currentMetadata, Snapshot snapshot) {}

/**
* Apply the update's changes to the base table metadata and return the new manifest list.
* Apply the update's changes to the given metadata and snapshot. Return the new manifest list.
*
* @param metadataToUpdate the base table metadata to apply changes to
* @param snapshot parent snapshot passed to child operations.
* @param snapshot snapshot to apply the changes to
* @return a manifest list for the new snapshot.
*/
protected abstract List<ManifestFile> apply(TableMetadata metadataToUpdate, Snapshot snapshot);
Expand Down