diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml index 3f8ec4b333a8..4c45b8f80d23 100644 --- a/.palantir/revapi.yml +++ b/.palantir/revapi.yml @@ -147,6 +147,12 @@ acceptedBreaks: - code: "java.method.addedToInterface" new: "method org.apache.iceberg.ReplacePartitions org.apache.iceberg.ReplacePartitions::validateNoConflictingDeletes()" justification: "Accept all changes prior to introducing API compatibility checks" + - code: "java.method.addedToInterface" + new: "method org.apache.iceberg.UpdateStatistics org.apache.iceberg.Table::updateStatistics()" + justification: "new API method" + - code: "java.method.addedToInterface" + new: "method org.apache.iceberg.UpdateStatistics org.apache.iceberg.Transaction::updateStatistics()" + justification: "new API method" - code: "java.method.addedToInterface" new: "method org.apache.iceberg.expressions.Expression org.apache.iceberg.Scan { + /** + * Set the table's statistics file for given snapshot, replacing the previous statistics file for + * the snapshot if any exists. + * + * @return this for method chaining + */ + UpdateStatistics setStatistics(long snapshotId, StatisticsFile statisticsFile); + + /** + * Remove the table's statistics file for given snapshot. + * + * @return this for method chaining + */ + UpdateStatistics removeStatistics(long snapshotId); +} diff --git a/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java b/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java index 920551b67f16..5bf8215dc986 100644 --- a/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java +++ b/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java @@ -223,6 +223,11 @@ public DeleteFiles newDelete() { throw new UnsupportedOperationException("Cannot delete from a metadata table"); } + @Override + public UpdateStatistics updateStatistics() { + throw new UnsupportedOperationException("Cannot update statistics of a metadata table"); + } + @Override public ExpireSnapshots expireSnapshots() { throw new UnsupportedOperationException("Cannot expire snapshots from a metadata table"); diff --git a/core/src/main/java/org/apache/iceberg/BaseTransaction.java b/core/src/main/java/org/apache/iceberg/BaseTransaction.java index 6f45390ce7ea..d5e82cff73cd 100644 --- a/core/src/main/java/org/apache/iceberg/BaseTransaction.java +++ b/core/src/main/java/org/apache/iceberg/BaseTransaction.java @@ -711,6 +711,11 @@ public DeleteFiles newDelete() { return BaseTransaction.this.newDelete(); } + @Override + public UpdateStatistics updateStatistics() { + return BaseTransaction.this.updateStatistics(); + } + @Override public ExpireSnapshots expireSnapshots() { return BaseTransaction.this.expireSnapshots(); diff --git a/core/src/main/java/org/apache/iceberg/CommitCallbackTransaction.java b/core/src/main/java/org/apache/iceberg/CommitCallbackTransaction.java index f1ad14590766..19b74a65ecad 100644 --- a/core/src/main/java/org/apache/iceberg/CommitCallbackTransaction.java +++ b/core/src/main/java/org/apache/iceberg/CommitCallbackTransaction.java @@ -101,6 +101,11 @@ public DeleteFiles newDelete() { return wrapped.newDelete(); } + @Override + public UpdateStatistics updateStatistics() { + return wrapped.updateStatistics(); + } + @Override public ExpireSnapshots expireSnapshots() { return wrapped.expireSnapshots(); diff --git a/core/src/main/java/org/apache/iceberg/SerializableTable.java b/core/src/main/java/org/apache/iceberg/SerializableTable.java index 7d3eb32ae6bb..8f8f27a76165 100644 --- a/core/src/main/java/org/apache/iceberg/SerializableTable.java +++ b/core/src/main/java/org/apache/iceberg/SerializableTable.java @@ -332,6 +332,11 @@ public DeleteFiles newDelete() { throw new UnsupportedOperationException(errorMsg("newDelete")); } + @Override + public UpdateStatistics updateStatistics() { + throw new UnsupportedOperationException(errorMsg("updateStatistics")); + } + @Override public ExpireSnapshots expireSnapshots() { throw new UnsupportedOperationException(errorMsg("expireSnapshots"));