diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml index b3a4ba39120c..b7894048f787 100644 --- a/.palantir/revapi.yml +++ b/.palantir/revapi.yml @@ -801,11 +801,10 @@ acceptedBreaks: - code: "java.method.removed" old: "method org.apache.iceberg.view.ViewBuilder org.apache.iceberg.view.ViewBuilder::withQueryColumnNames(java.util.List)" justification: "Acceptable break due to updating View APIs and the View Spec" + - code: "java.method.removed" + old: "method void org.apache.iceberg.view.ViewVersion::check()" + justification: "Acceptable break due to updating View APIs" org.apache.iceberg:iceberg-core: - - code: "java.method.visibilityReduced" - old: "method void org.apache.iceberg.encryption.Ciphers::()" - new: "method void org.apache.iceberg.encryption.Ciphers::()" - justification: "Static utility class - should not have public constructor" - code: "java.class.removed" old: "class org.apache.iceberg.actions.BaseDeleteOrphanFilesActionResult" justification: "Removing deprecated code" @@ -857,6 +856,10 @@ acceptedBreaks: old: "method void org.apache.iceberg.MergingSnapshotProducer::setNewFilesSequenceNumber(long)\ \ @ org.apache.iceberg.StreamingDelete" justification: "Removing deprecated code" + - code: "java.method.visibilityReduced" + old: "method void org.apache.iceberg.encryption.Ciphers::()" + new: "method void org.apache.iceberg.encryption.Ciphers::()" + justification: "Static utility class - should not have public constructor" apache-iceberg-0.14.0: org.apache.iceberg:iceberg-api: - code: "java.class.defaultSerializationChanged" diff --git a/api/src/main/java/org/apache/iceberg/view/ViewVersion.java b/api/src/main/java/org/apache/iceberg/view/ViewVersion.java index 1a04b6b12066..f68300827c16 100644 --- a/api/src/main/java/org/apache/iceberg/view/ViewVersion.java +++ b/api/src/main/java/org/apache/iceberg/view/ViewVersion.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Map; import org.apache.iceberg.catalog.Namespace; -import org.apache.iceberg.relocated.com.google.common.base.Preconditions; /** * A version of the view at a point in time. @@ -79,9 +78,4 @@ default String defaultCatalog() { /** The default namespace to use when the SQL does not contain a namespace. */ Namespace defaultNamespace(); - - default void check() { - Preconditions.checkArgument( - summary().containsKey("operation"), "Invalid view version summary, missing operation"); - } } diff --git a/core/src/main/java/org/apache/iceberg/view/BaseViewVersion.java b/core/src/main/java/org/apache/iceberg/view/BaseViewVersion.java index e787bf65e139..f07f4ffda355 100644 --- a/core/src/main/java/org/apache/iceberg/view/BaseViewVersion.java +++ b/core/src/main/java/org/apache/iceberg/view/BaseViewVersion.java @@ -19,6 +19,7 @@ package org.apache.iceberg.view; import javax.annotation.Nullable; +import org.apache.iceberg.relocated.com.google.common.base.Preconditions; import org.immutables.value.Value; import org.immutables.value.Value.Style.BuilderVisibility; import org.immutables.value.Value.Style.ImplementationVisibility; @@ -41,16 +42,12 @@ interface BaseViewVersion extends ViewVersion { @Override @Value.Lazy default String operation() { + Preconditions.checkArgument( + summary().containsKey("operation"), "Invalid view version summary, missing operation"); return summary().get("operation"); } @Override @Nullable String defaultCatalog(); - - @Override - @Value.Check - default void check() { - ViewVersion.super.check(); - } } diff --git a/core/src/test/java/org/apache/iceberg/view/TestViewVersionParser.java b/core/src/test/java/org/apache/iceberg/view/TestViewVersionParser.java index e50d60288483..882c423c2a2c 100644 --- a/core/src/test/java/org/apache/iceberg/view/TestViewVersionParser.java +++ b/core/src/test/java/org/apache/iceberg/view/TestViewVersionParser.java @@ -113,7 +113,9 @@ public void testFailParsingMissingOperation() { "{\"version-id\":1,\"timestamp-ms\":12345,\"summary\":{\"some-other-field\":\"some-other-value\"},\"representations\":%s,\"schema-id\":1,\"default-namespace\":[\"one\",\"two\"]}", serializedRepresentations); - Assertions.assertThatThrownBy(() -> ViewVersionParser.fromJson(viewVersionMissingOperation)) + // parsing a view version with an invalid operation shouldn't fail + ViewVersion viewVersion = ViewVersionParser.fromJson(viewVersionMissingOperation); + Assertions.assertThatThrownBy(() -> viewVersion.operation()) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Invalid view version summary, missing operation"); @@ -125,7 +127,8 @@ public void testFailParsingMissingOperation() { .schemaId(1) .defaultNamespace(Namespace.of("one", "two")) .summary(ImmutableMap.of("user", "some-user")) - .build()) + .build() + .operation()) .isInstanceOf(IllegalArgumentException.class) .hasMessage("Invalid view version summary, missing operation"); }