Skip to content

Commit

Permalink
use metadata changes instead of updated table metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
nastra committed May 15, 2023
1 parent 6f93d8b commit b3fcfd3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
*/
package org.apache.iceberg.catalog;

import java.util.List;
import org.apache.iceberg.MetadataUpdate;
import org.apache.iceberg.TableMetadata;
import org.immutables.value.Value;

Expand All @@ -27,5 +29,5 @@ public interface TableCommit {

TableMetadata base();

TableMetadata updated();
List<MetadataUpdate> changes();
}
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,7 @@ public void commitTransaction(SessionContext context, List<TableCommit> commits)

for (TableCommit commit : commits) {
UpdateTableRequest.Builder updateTableBuilder = UpdateTableRequest.builderFor(commit.base());
commit.updated().changes().forEach(updateTableBuilder::update);
commit.changes().forEach(updateTableBuilder::update);
UpdateTableRequest updateTableRequest = updateTableBuilder.build();

ImmutableCommitTableRequest commitTableRequest =
Expand Down
10 changes: 5 additions & 5 deletions core/src/test/java/org/apache/iceberg/rest/TestRESTCatalog.java
Original file line number Diff line number Diff line change
Expand Up @@ -1775,7 +1775,7 @@ public void multipleDiffsAgainstSingleTable() {
ImmutableTableCommit.builder()
.identifier(identifier)
.base(((BaseTransaction) transaction).startMetadata())
.updated(((BaseTransaction) transaction).currentMetadata())
.changes(((BaseTransaction) transaction).currentMetadata().changes())
.build();

restCatalog.commitTransaction(ImmutableList.of(tableCommit));
Expand Down Expand Up @@ -1808,14 +1808,14 @@ public void multipleDiffsAgainstMultipleTables() {
ImmutableTableCommit.builder()
.identifier(identifier1)
.base(((BaseTransaction) transaction1).startMetadata())
.updated(((BaseTransaction) transaction1).currentMetadata())
.changes(((BaseTransaction) transaction1).currentMetadata().changes())
.build();

TableCommit tableCommit2 =
ImmutableTableCommit.builder()
.identifier(identifier2)
.base(((BaseTransaction) transaction2).startMetadata())
.updated(((BaseTransaction) transaction2).currentMetadata())
.changes(((BaseTransaction) transaction2).currentMetadata().changes())
.build();

restCatalog.commitTransaction(ImmutableList.of(tableCommit1, tableCommit2));
Expand Down Expand Up @@ -1854,14 +1854,14 @@ public void multipleDiffsAgainstMultipleTablesLastFails() {
ImmutableTableCommit.builder()
.identifier(identifier1)
.base(((BaseTransaction) transaction1).startMetadata())
.updated(((BaseTransaction) transaction1).currentMetadata())
.changes(((BaseTransaction) transaction1).currentMetadata().changes())
.build();

TableCommit tableCommit2 =
ImmutableTableCommit.builder()
.identifier(identifier2)
.base(((BaseTransaction) transaction2).startMetadata())
.updated(((BaseTransaction) transaction2).currentMetadata())
.changes(((BaseTransaction) transaction2).currentMetadata().changes())
.build();

assertThatThrownBy(
Expand Down

0 comments on commit b3fcfd3

Please sign in to comment.