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
25 changes: 25 additions & 0 deletions core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(numSnapshots)
.containsExactlyInAnyOrderElementsOf(
((BaseTable) table).operations().current().snapshotLog());

assertThat(refsTable.currentSnapshot()).isEqualTo(table.currentSnapshot());
assertThat(refsTable.snapshots()).hasSize(numSnapshots);
assertThat(refsTable.history()).hasSize(numSnapshots);
Expand Down
6 changes: 3 additions & 3 deletions open-api/rest-catalog-open-api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading