nastra commented on code in PR #14334:
URL: https://github.com/apache/iceberg/pull/14334#discussion_r2438787441


##########
core/src/test/java/org/apache/iceberg/view/ViewCatalogTests.java:
##########
@@ -1746,102 +1753,83 @@ public void concurrentReplaceViewVersion() {
     ViewOperations viewOps = ((BaseView) view).operations();
     ViewMetadata current = viewOps.current();
 
-    ViewMetadata trinoUpdate = ((ViewVersionReplace) 
replaceViewVersionTwo).internalApply();
-    ViewMetadata sparkUpdate = ((ViewVersionReplace) 
replaceViewVersionOne).internalApply();
+    ViewMetadata trinoUpdate = ((ViewVersionReplace) 
replaceViewVersionOne).internalApply();
+    ViewMetadata sparkUpdate = ((ViewVersionReplace) 
replaceViewVersionTwo).internalApply();
 
     viewOps.commit(current, trinoUpdate);
 
-    if (supportsServerSideRetry()) {
-      // retry should succeed and the changes should be applied
-      viewOps.commit(current, sparkUpdate);
-
-      View updatedView = catalog().loadView(identifier);
-      ViewVersion viewVersion = updatedView.currentVersion();
-      assertThat(viewVersion.versionId()).isEqualTo(3);
-      assertThat(updatedView.versions()).hasSize(3);
-      assertThat(updatedView.version(1))
-          .isEqualTo(
-              ImmutableViewVersion.builder()
-                  .timestampMillis(updatedView.version(1).timestampMillis())
-                  .versionId(1)
-                  .schemaId(0)
-                  .summary(updatedView.version(1).summary())
-                  .defaultNamespace(identifier.namespace())
-                  .addRepresentations(
-                      ImmutableSQLViewRepresentation.builder()
-                          .sql("select * from ns.tbl")
-                          .dialect("trino")
-                          .build())
-                  .build());
-
-      assertThat(updatedView.version(2))
-          .isEqualTo(
-              ImmutableViewVersion.builder()
-                  .timestampMillis(updatedView.version(2).timestampMillis())
-                  .versionId(2)
-                  .schemaId(1)
-                  .summary(updatedView.version(2).summary())
-                  .defaultNamespace(identifier.namespace())
-                  .addRepresentations(
-                      ImmutableSQLViewRepresentation.builder()
-                          .sql("select count(some_id) from ns.tbl")
-                          .dialect("spark")
-                          .build())
-                  .build());
-
-      assertThat(updatedView.version(3))
-          .isEqualTo(
-              ImmutableViewVersion.builder()
-                  .timestampMillis(updatedView.version(3).timestampMillis())
-                  .versionId(3)
-                  .schemaId(0)
-                  .summary(updatedView.version(3).summary())
-                  .defaultNamespace(identifier.namespace())
-                  .addRepresentations(
-                      ImmutableSQLViewRepresentation.builder()
-                          .sql("select count(id) from ns.tbl")
-                          .dialect("trino")
-                          .build())
-                  .build());
-    } else {
-      assertThatThrownBy(() -> viewOps.commit(current, sparkUpdate))
-          .isInstanceOf(CommitFailedException.class)
-          .hasMessageContaining("Cannot commit");
-
-      View updatedView = catalog().loadView(identifier);
-      ViewVersion viewVersion = updatedView.currentVersion();
-      assertThat(viewVersion.versionId()).isEqualTo(2);
-      assertThat(updatedView.versions()).hasSize(2);
-      assertThat(updatedView.version(1))
-          .isEqualTo(
-              ImmutableViewVersion.builder()
-                  .timestampMillis(updatedView.version(1).timestampMillis())
-                  .versionId(1)
-                  .schemaId(0)
-                  .summary(updatedView.version(1).summary())
-                  .defaultNamespace(identifier.namespace())
-                  .addRepresentations(
-                      ImmutableSQLViewRepresentation.builder()
-                          .sql("select * from ns.tbl")
-                          .dialect("trino")
-                          .build())
-                  .build());
-
-      assertThat(updatedView.version(2))
-          .isEqualTo(
-              ImmutableViewVersion.builder()
-                  .timestampMillis(updatedView.version(2).timestampMillis())
-                  .versionId(2)
-                  .schemaId(1)
-                  .summary(updatedView.version(2).summary())
-                  .defaultNamespace(identifier.namespace())
-                  .addRepresentations(
-                      ImmutableSQLViewRepresentation.builder()
-                          .sql("select count(some_id) from ns.tbl")
-                          .dialect("spark")
-                          .build())
-                  .build());
-    }
+    // second commit should fail with a conflict
+    assertThatThrownBy(() -> viewOps.commit(current, sparkUpdate))

Review Comment:
   please add new tests instead of updating existing ones



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to