From 681d9b2545d25773eea12db03e9f7dedf6ffecd0 Mon Sep 17 00:00:00 2001 From: Gabor Kaszab Date: Wed, 6 May 2026 14:20:48 +0200 Subject: [PATCH 1/2] Spec, Core: Disambiguate the intent of REFS snapshot mode Spell out that it has an effect on the 'snapshots' and not the 'snapshot-log' part of the response. Some implementations already got it wrong. --- .../apache/iceberg/rest/TestRESTCatalog.java | 25 +++++++++++++++++++ open-api/rest-catalog-open-api.yaml | 6 ++--- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java b/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java index e4fa156059d8..c2e3ec515810 100644 --- a/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java +++ b/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java @@ -62,6 +62,7 @@ import org.apache.iceberg.DataFile; import org.apache.iceberg.DataFiles; import org.apache.iceberg.HasTableOperations; +import org.apache.iceberg.HistoryEntry; import org.apache.iceberg.MetadataUpdate; import org.apache.iceberg.PartitionSpec; import org.apache.iceberg.Schema; @@ -1086,6 +1087,14 @@ public void testTableSnapshotLoading() { .asInstanceOf(InstanceOfAssertFactories.list(Snapshot.class)) .hasSize(1); + // snapshot log is complete regardless REFS mode + assertThat(((BaseTable) refsTable).operations().current()) + .extracting("snapshotLog") + .asInstanceOf(InstanceOfAssertFactories.list(HistoryEntry.class)) + .hasSize(2) + .containsExactlyInAnyOrderElementsOf( + ((BaseTable) table).operations().current().snapshotLog()); + assertThat(refsTable.currentSnapshot()).isEqualTo(table.currentSnapshot()); // verify that the table was loaded with the refs argument @@ -1180,6 +1189,14 @@ public void testTableSnapshotLoadingWithDivergedBranches(String formatVersion) { .asInstanceOf(InstanceOfAssertFactories.list(Snapshot.class)) .hasSize(2); + // snapshot log is complete regardless REFS mode + assertThat(((BaseTable) refsTable).operations().current()) + .extracting("snapshotLog") + .asInstanceOf(InstanceOfAssertFactories.list(HistoryEntry.class)) + .hasSize(1) // main branch has a single snapshot + .containsExactlyInAnyOrderElementsOf( + ((BaseTable) table).operations().current().snapshotLog()); + assertThat(refsTable.currentSnapshot()).isEqualTo(table.currentSnapshot()); // verify that the table was loaded with the refs argument @@ -1265,6 +1282,14 @@ public void lazySnapshotLoadingWithDivergedHistory() { .asInstanceOf(InstanceOfAssertFactories.list(Snapshot.class)) .hasSize(1); + // snapshot log is complete regardless REFS mode + assertThat(((BaseTable) refsTable).operations().current()) + .extracting("snapshotLog") + .asInstanceOf(InstanceOfAssertFactories.list(HistoryEntry.class)) + .hasSize(5) + .containsExactlyInAnyOrderElementsOf( + ((BaseTable) table).operations().current().snapshotLog()); + assertThat(refsTable.currentSnapshot()).isEqualTo(table.currentSnapshot()); assertThat(refsTable.snapshots()).hasSize(numSnapshots); assertThat(refsTable.history()).hasSize(numSnapshots); diff --git a/open-api/rest-catalog-open-api.yaml b/open-api/rest-catalog-open-api.yaml index 2435cd43f0e5..06d13ec133d9 100644 --- a/open-api/rest-catalog-open-api.yaml +++ b/open-api/rest-catalog-open-api.yaml @@ -983,9 +983,9 @@ paths: - in: query name: snapshots description: - The snapshots to return in the body of the metadata. Setting the value to `all` would - return the full set of snapshots currently valid for the table. Setting the value to - `refs` would load all snapshots referenced by branches or tags. + The snapshots to return in the body of the metadata via the `snapshots` field. Setting + the value to `all` would return the full set of snapshots currently valid for the table. + Setting the value to `refs` would load all snapshots referenced by branches or tags. Default if no param is provided is `all`. required: false From 6f548c3409432eaf87c4a07fdaa8eab1043c8679 Mon Sep 17 00:00:00 2001 From: gaborkaszab Date: Fri, 8 May 2026 14:33:11 +0200 Subject: [PATCH 2/2] Update core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java Co-authored-by: Eduard Tudenhoefner --- core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java b/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java index c2e3ec515810..017f400f860f 100644 --- a/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java +++ b/core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java @@ -1286,7 +1286,7 @@ public void lazySnapshotLoadingWithDivergedHistory() { assertThat(((BaseTable) refsTable).operations().current()) .extracting("snapshotLog") .asInstanceOf(InstanceOfAssertFactories.list(HistoryEntry.class)) - .hasSize(5) + .hasSize(numSnapshots) .containsExactlyInAnyOrderElementsOf( ((BaseTable) table).operations().current().snapshotLog());