This is an automated email from the ASF dual-hosted git repository.

etudenhoefner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/iceberg.git


The following commit(s) were added to refs/heads/main by this push:
     new d17a7f189a Core: Remove deprecated APIs for 1.7.0 (#10818)
d17a7f189a is described below

commit d17a7f189afa25c6be37df1415f4e2f8594effbe
Author: Naveen Kumar <[email protected]>
AuthorDate: Fri Aug 9 15:04:36 2024 +0530

    Core: Remove deprecated APIs for 1.7.0 (#10818)
---
 .palantir/revapi.yml                               | 75 ++++++++++++++++++++++
 .../org/apache/iceberg/common/DynConstructors.java | 18 +-----
 .../java/org/apache/iceberg/common/DynFields.java  | 15 -----
 .../java/org/apache/iceberg/common/DynMethods.java | 38 +----------
 .../iceberg/BaseMetastoreTableOperations.java      | 11 ----
 .../org/apache/iceberg/FileScanTaskParser.java     | 29 ---------
 .../java/org/apache/iceberg/SnapshotProducer.java  | 12 ----
 .../java/org/apache/iceberg/io/ContentCache.java   | 25 +-------
 .../org/apache/iceberg/rest/auth/OAuth2Util.java   | 20 ------
 .../org/apache/iceberg/TestFileScanTaskParser.java | 30 ---------
 .../apache/iceberg/hive/HiveOperationsBase.java    | 10 ---
 11 files changed, 81 insertions(+), 202 deletions(-)

diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml
index 3018840b45..e58ce70ded 100644
--- a/.palantir/revapi.yml
+++ b/.palantir/revapi.yml
@@ -1056,6 +1056,81 @@ acceptedBreaks:
     - code: "java.method.removed"
       old: "method org.apache.iceberg.DataFiles.Builder 
org.apache.iceberg.DataFiles.Builder::withEqualityFieldIds(java.util.List<java.lang.Integer>)"
       justification: "Deprecations for 1.6.0 release"
+  "1.6.0":
+    org.apache.iceberg:iceberg-common:
+    - code: "java.method.removed"
+      old: "method <T> org.apache.iceberg.common.DynFields.StaticField<T> 
org.apache.iceberg.common.DynFields.Builder::buildStaticChecked()\
+        \ throws java.lang.NoSuchFieldException"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method java.lang.Class<? extends C> 
org.apache.iceberg.common.DynConstructors.Ctor<C>::getConstructedClass()"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.common.DynConstructors.Builder 
org.apache.iceberg.common.DynConstructors.Builder::hiddenImpl(java.lang.Class<?>[])"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.common.DynMethods.Builder 
org.apache.iceberg.common.DynMethods.Builder::ctorImpl(java.lang.Class<?>,\
+        \ java.lang.Class<?>[])"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.common.DynMethods.Builder 
org.apache.iceberg.common.DynMethods.Builder::ctorImpl(java.lang.String,\
+        \ java.lang.Class<?>[])"
+      justification: "Removing deprecated code"
+    - code: "java.method.visibilityReduced"
+      old: "method <R> R 
org.apache.iceberg.common.DynMethods.UnboundMethod::invokeChecked(java.lang.Object,\
+        \ java.lang.Object[]) throws java.lang.Exception"
+      new: "method <R> R 
org.apache.iceberg.common.DynMethods.UnboundMethod::invokeChecked(java.lang.Object,\
+        \ java.lang.Object[]) throws java.lang.Exception"
+      justification: "Reduced visibility and scoped to package"
+    org.apache.iceberg:iceberg-core:
+    - code: "java.class.removed"
+      old: "enum org.apache.iceberg.BaseMetastoreTableOperations.CommitStatus"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method java.lang.String 
org.apache.iceberg.FileScanTaskParser::toJson(org.apache.iceberg.FileScanTask)"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.FileScanTask 
org.apache.iceberg.FileScanTaskParser::fromJson(java.lang.String,\
+        \ boolean)"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.ContentCache.CacheEntry 
org.apache.iceberg.io.ContentCache::get(java.lang.String,\
+        \ java.util.function.Function<java.lang.String, 
org.apache.iceberg.io.ContentCache.FileContent>)"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.ContentCache.CacheEntry 
org.apache.iceberg.io.ContentCache::getIfPresent(java.lang.String)"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.InputFile 
org.apache.iceberg.io.ContentCache::tryCache(org.apache.iceberg.io.FileIO,\
+        \ java.lang.String, long)"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.OutputFile 
org.apache.iceberg.SnapshotProducer<ThisT>::newManifestOutput()\
+        \ @ org.apache.iceberg.BaseOverwriteFiles"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.OutputFile 
org.apache.iceberg.SnapshotProducer<ThisT>::newManifestOutput()\
+        \ @ org.apache.iceberg.BaseReplacePartitions"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.OutputFile 
org.apache.iceberg.SnapshotProducer<ThisT>::newManifestOutput()\
+        \ @ org.apache.iceberg.BaseRewriteManifests"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method org.apache.iceberg.io.OutputFile 
org.apache.iceberg.SnapshotProducer<ThisT>::newManifestOutput()\
+        \ @ org.apache.iceberg.StreamingDelete"
+      justification: "Removing deprecated code"
+    - code: "java.method.removed"
+      old: "method void 
org.apache.iceberg.rest.auth.OAuth2Util.AuthSession::<init>(java.util.Map<java.lang.String,\
+        \ java.lang.String>, java.lang.String, java.lang.String, 
java.lang.String,\
+        \ java.lang.String, java.lang.String)"
+      justification: "Removing deprecated code"
+    - code: "java.method.returnTypeChanged"
+      old: "method 
org.apache.iceberg.BaseMetastoreTableOperations.CommitStatus 
org.apache.iceberg.BaseMetastoreTableOperations::checkCommitStatus(java.lang.String,\
+        \ org.apache.iceberg.TableMetadata)"
+      new: "method org.apache.iceberg.BaseMetastoreOperations.CommitStatus 
org.apache.iceberg.BaseMetastoreTableOperations::checkCommitStatus(java.lang.String,\
+        \ org.apache.iceberg.TableMetadata)"
+      justification: "Removing deprecated code"
   apache-iceberg-0.14.0:
     org.apache.iceberg:iceberg-api:
     - code: "java.class.defaultSerializationChanged"
diff --git 
a/common/src/main/java/org/apache/iceberg/common/DynConstructors.java 
b/common/src/main/java/org/apache/iceberg/common/DynConstructors.java
index 7c77711287..7ec8716c86 100644
--- a/common/src/main/java/org/apache/iceberg/common/DynConstructors.java
+++ b/common/src/main/java/org/apache/iceberg/common/DynConstructors.java
@@ -43,12 +43,6 @@ public class DynConstructors {
       this.constructed = constructed;
     }
 
-    /** @deprecated since 1.6.0, will be removed in 1.7.0 */
-    @Deprecated
-    public Class<? extends C> getConstructedClass() {
-      return constructed;
-    }
-
     public C newInstanceChecked(Object... args) throws Exception {
       try {
         if (args.length > ctor.getParameterCount()) {
@@ -82,6 +76,8 @@ public class DynConstructors {
       return (R) newInstance(args);
     }
 
+    /** @deprecated since 1.7.0, visibility will be reduced in 1.8.0 */
+    @Deprecated // will become package-private
     @Override
     @SuppressWarnings("unchecked")
     public <R> R invokeChecked(Object target, Object... args) throws Exception 
{
@@ -172,16 +168,6 @@ public class DynConstructors {
       return this;
     }
 
-    /**
-     * @deprecated since 1.6.0, will be removed in 1.7.0; This varargs method 
conflicts with {@link
-     *     #hiddenImpl(Class, Class...)}. Use {@link #builder(Class)} instead.
-     */
-    @Deprecated
-    public Builder hiddenImpl(Class<?>... types) {
-      hiddenImpl(baseClass, types);
-      return this;
-    }
-
     public Builder hiddenImpl(String className, Class<?>... types) {
       // don't do any work if an implementation has been found
       if (ctor != null) {
diff --git a/common/src/main/java/org/apache/iceberg/common/DynFields.java 
b/common/src/main/java/org/apache/iceberg/common/DynFields.java
index e88affa0cb..cc397d329e 100644
--- a/common/src/main/java/org/apache/iceberg/common/DynFields.java
+++ b/common/src/main/java/org/apache/iceberg/common/DynFields.java
@@ -386,21 +386,6 @@ public class DynFields {
       return this.<T>build().bind(target);
     }
 
-    /**
-     * Returns the first valid implementation as a StaticField or throws a 
NoSuchFieldException if
-     * there is none.
-     *
-     * @param <T> Java class stored in the field
-     * @return a {@link StaticField} with a valid implementation
-     * @throws IllegalStateException if the method is not static
-     * @throws NoSuchFieldException if no implementation was found
-     * @deprecated since 1.6.0, will be removed in 1.7.0
-     */
-    @Deprecated
-    public <T> StaticField<T> buildStaticChecked() throws NoSuchFieldException 
{
-      return this.<T>buildChecked().asStatic();
-    }
-
     /**
      * Returns the first valid implementation as a StaticField or throws a 
RuntimeException if there
      * is none.
diff --git a/common/src/main/java/org/apache/iceberg/common/DynMethods.java 
b/common/src/main/java/org/apache/iceberg/common/DynMethods.java
index fc0e578c7d..65a69bd0e1 100644
--- a/common/src/main/java/org/apache/iceberg/common/DynMethods.java
+++ b/common/src/main/java/org/apache/iceberg/common/DynMethods.java
@@ -51,10 +51,8 @@ public class DynMethods {
           (method == null || method.isVarArgs()) ? -1 : 
method.getParameterTypes().length;
     }
 
-    /** @deprecated since 1.6.0, will be removed in 1.7.0 */
-    @Deprecated // will become private
     @SuppressWarnings("unchecked")
-    public <R> R invokeChecked(Object target, Object... args) throws Exception 
{
+    <R> R invokeChecked(Object target, Object... args) throws Exception {
       try {
         if (argLength < 0) {
           return (R) method.invoke(target, args);
@@ -127,6 +125,8 @@ public class DynMethods {
     /** Singleton {@link UnboundMethod}, performs no operation and returns 
null. */
     private static final UnboundMethod NOOP =
         new UnboundMethod(null, "NOOP") {
+          /** @deprecated since 1.7.0, visibility will be reduced in 1.8.0 */
+          @Deprecated // will become package-private
           @Override
           public <R> R invokeChecked(Object target, Object... args) {
             return null;
@@ -315,38 +315,6 @@ public class DynMethods {
       return this;
     }
 
-    /** @deprecated since 1.6.0, will be removed in 1.7.0 */
-    @Deprecated
-    public Builder ctorImpl(Class<?> targetClass, Class<?>... argClasses) {
-      // don't do any work if an implementation has been found
-      if (method != null) {
-        return this;
-      }
-
-      try {
-        this.method = new DynConstructors.Builder().impl(targetClass, 
argClasses).buildChecked();
-      } catch (NoSuchMethodException e) {
-        // not the right implementation
-      }
-      return this;
-    }
-
-    /** @deprecated since 1.6.0, will be removed in 1.7.0 */
-    @Deprecated
-    public Builder ctorImpl(String className, Class<?>... argClasses) {
-      // don't do any work if an implementation has been found
-      if (method != null) {
-        return this;
-      }
-
-      try {
-        this.method = new DynConstructors.Builder().impl(className, 
argClasses).buildChecked();
-      } catch (NoSuchMethodException e) {
-        // not the right implementation
-      }
-      return this;
-    }
-
     /**
      * Checks for an implementation, first finding the given class by name.
      *
diff --git 
a/core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java 
b/core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java
index 90d4358110..5c82bc877a 100644
--- a/core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java
+++ b/core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java
@@ -284,17 +284,6 @@ public abstract class BaseMetastoreTableOperations extends 
BaseMetastoreOperatio
     };
   }
 
-  /**
-   * @deprecated since 1.6.0, will be removed in 1.7.0; Use {@link
-   *     BaseMetastoreOperations.CommitStatus} instead
-   */
-  @Deprecated
-  protected enum CommitStatus {
-    FAILURE,
-    SUCCESS,
-    UNKNOWN
-  }
-
   /**
    * Attempt to load the table and see if any current or past metadata 
location matches the one we
    * were attempting to set. This is used as a last resort when we are dealing 
with exceptions that
diff --git a/core/src/main/java/org/apache/iceberg/FileScanTaskParser.java 
b/core/src/main/java/org/apache/iceberg/FileScanTaskParser.java
index a6ea41319f..7ae7dc74a7 100644
--- a/core/src/main/java/org/apache/iceberg/FileScanTaskParser.java
+++ b/core/src/main/java/org/apache/iceberg/FileScanTaskParser.java
@@ -40,35 +40,6 @@ public class FileScanTaskParser {
 
   private FileScanTaskParser() {}
 
-  /**
-   * Serialize file scan task to JSON string
-   *
-   * @deprecated will be removed in 1.7.0; use {@link 
ScanTaskParser#toJson(FileScanTask)} instead
-   */
-  @Deprecated
-  public static String toJson(FileScanTask fileScanTask) {
-    Preconditions.checkArgument(fileScanTask != null, "Invalid file scan task: 
null");
-    return JsonUtil.generate(
-        generator -> {
-          generator.writeStartObject();
-          toJson(fileScanTask, generator);
-          generator.writeEndObject();
-        },
-        false);
-  }
-
-  /**
-   * Deserialize file scan task from JSON string
-   *
-   * @deprecated will be removed in 1.7.0; use {@link 
ScanTaskParser#fromJson(String, boolean)}
-   *     instead
-   */
-  @Deprecated
-  public static FileScanTask fromJson(String json, boolean caseSensitive) {
-    Preconditions.checkArgument(json != null, "Invalid JSON string for file 
scan task: null");
-    return JsonUtil.parse(json, node -> fromJson(node, caseSensitive));
-  }
-
   static void toJson(FileScanTask fileScanTask, JsonGenerator generator) 
throws IOException {
     Preconditions.checkArgument(fileScanTask != null, "Invalid file scan task: 
null");
     Preconditions.checkArgument(generator != null, "Invalid JSON generator: 
null");
diff --git a/core/src/main/java/org/apache/iceberg/SnapshotProducer.java 
b/core/src/main/java/org/apache/iceberg/SnapshotProducer.java
index 0a040fe344..74997cc898 100644
--- a/core/src/main/java/org/apache/iceberg/SnapshotProducer.java
+++ b/core/src/main/java/org/apache/iceberg/SnapshotProducer.java
@@ -500,18 +500,6 @@ abstract class SnapshotProducer<ThisT> implements 
SnapshotUpdate<ThisT> {
                         "snap-%d-%d-%s", snapshotId(), 
attempt.incrementAndGet(), commitUUID))));
   }
 
-  /**
-   * @deprecated will be removed in 1.7.0; Use {@link 
SnapshotProducer#newManifestOutputFile}
-   *     instead
-   */
-  @Deprecated
-  protected OutputFile newManifestOutput() {
-    return ops.io()
-        .newOutputFile(
-            ops.metadataFileLocation(
-                FileFormat.AVRO.addExtension(commitUUID + "-m" + 
manifestCount.getAndIncrement())));
-  }
-
   protected EncryptedOutputFile newManifestOutputFile() {
     String manifestFileLocation =
         ops.metadataFileLocation(
diff --git a/core/src/main/java/org/apache/iceberg/io/ContentCache.java 
b/core/src/main/java/org/apache/iceberg/io/ContentCache.java
index 7942c69d5d..ce37cfb089 100644
--- a/core/src/main/java/org/apache/iceberg/io/ContentCache.java
+++ b/core/src/main/java/org/apache/iceberg/io/ContentCache.java
@@ -28,7 +28,6 @@ import java.io.UncheckedIOException;
 import java.nio.ByteBuffer;
 import java.time.Duration;
 import java.util.List;
-import java.util.function.Function;
 import org.apache.iceberg.exceptions.NotFoundException;
 import org.apache.iceberg.exceptions.ValidationException;
 import org.apache.iceberg.relocated.com.google.common.base.MoreObjects;
@@ -111,24 +110,6 @@ public class ContentCache {
     return cache.stats();
   }
 
-  /** @deprecated will be removed in 1.7; use {@link #tryCache(InputFile)} 
instead */
-  @Deprecated
-  public CacheEntry get(String key, Function<String, FileContent> 
mappingFunction) {
-    return cache.get(key, mappingFunction);
-  }
-
-  /** @deprecated will be removed in 1.7; use {@link #tryCache(InputFile)} 
instead */
-  @Deprecated
-  public CacheEntry getIfPresent(String location) {
-    return cache.getIfPresent(location);
-  }
-
-  /** @deprecated will be removed in 1.7; use {@link #tryCache(InputFile)} 
instead */
-  @Deprecated
-  public InputFile tryCache(FileIO io, String location, long length) {
-    return tryCache(io.newInputFile(location, length));
-  }
-
   /**
    * Try cache the file-content of file in the given location upon stream 
reading.
    *
@@ -173,11 +154,7 @@ public class ContentCache {
         .toString();
   }
 
-  /** @deprecated will be removed in 1.7; use {@link FileContent} instead. */
-  @Deprecated
-  private static class CacheEntry {}
-
-  private static class FileContent extends CacheEntry {
+  private static class FileContent {
     private final long length;
     private final List<ByteBuffer> buffers;
 
diff --git a/core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java 
b/core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java
index 189e5fde2c..52c89af9d4 100644
--- a/core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java
+++ b/core/src/main/java/org/apache/iceberg/rest/auth/OAuth2Util.java
@@ -465,26 +465,6 @@ public class OAuth2Util {
       this.config = config;
     }
 
-    /** @deprecated since 1.6.0, will be removed in 1.7.0 */
-    @Deprecated
-    public AuthSession(
-        Map<String, String> baseHeaders,
-        String token,
-        String tokenType,
-        String credential,
-        String scope,
-        String oauth2ServerUri) {
-      this(
-          baseHeaders,
-          AuthConfig.builder()
-              .token(token)
-              .tokenType(tokenType)
-              .credential(credential)
-              .scope(scope)
-              .oauth2ServerUri(oauth2ServerUri)
-              .build());
-    }
-
     public Map<String, String> headers() {
       return headers;
     }
diff --git a/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java 
b/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java
index 137e789738..c4a9fdf234 100644
--- a/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java
+++ b/core/src/test/java/org/apache/iceberg/TestFileScanTaskParser.java
@@ -31,14 +31,6 @@ import org.junit.jupiter.params.provider.ValueSource;
 public class TestFileScanTaskParser {
   @Test
   public void testNullArguments() {
-    assertThatThrownBy(() -> FileScanTaskParser.toJson(null))
-        .isInstanceOf(IllegalArgumentException.class)
-        .hasMessage("Invalid file scan task: null");
-
-    assertThatThrownBy(() -> FileScanTaskParser.fromJson((String) null, true))
-        .isInstanceOf(IllegalArgumentException.class)
-        .hasMessage("Invalid JSON string for file scan task: null");
-
     assertThatThrownBy(() -> ScanTaskParser.toJson(null))
         .isInstanceOf(IllegalArgumentException.class)
         .hasMessage("Invalid scan task: null");
@@ -48,28 +40,6 @@ public class TestFileScanTaskParser {
         .hasMessage("Invalid JSON string for scan task: null");
   }
 
-  @ParameterizedTest
-  @ValueSource(booleans = {true, false})
-  public void testFileScanTaskParser(boolean caseSensitive) {
-    PartitionSpec spec = TestBase.SPEC;
-    FileScanTask fileScanTask = createFileScanTask(spec, caseSensitive);
-    String jsonStr = FileScanTaskParser.toJson(fileScanTask);
-    assertThat(jsonStr).isEqualTo(fileScanTaskJsonWithoutTaskType());
-    FileScanTask deserializedTask = FileScanTaskParser.fromJson(jsonStr, 
caseSensitive);
-    assertFileScanTaskEquals(fileScanTask, deserializedTask, spec, 
caseSensitive);
-  }
-
-  /** Test backward compatibility where task-type field is absent from the 
JSON string */
-  @ParameterizedTest
-  @ValueSource(booleans = {true, false})
-  public void testFileScanTaskParserWithoutTaskTypeField(boolean 
caseSensitive) {
-    PartitionSpec spec = TestBase.SPEC;
-    FileScanTask fileScanTask = createFileScanTask(spec, caseSensitive);
-    FileScanTask deserializedTask =
-        FileScanTaskParser.fromJson(fileScanTaskJsonWithoutTaskType(), 
caseSensitive);
-    assertFileScanTaskEquals(fileScanTask, deserializedTask, spec, 
caseSensitive);
-  }
-
   @ParameterizedTest
   @ValueSource(booleans = {true, false})
   public void testScanTaskParser(boolean caseSensitive) {
diff --git 
a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java 
b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
index 055a14246e..6500e724a4 100644
--- 
a/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
+++ 
b/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
@@ -31,7 +31,6 @@ import org.apache.iceberg.BaseMetastoreTableOperations;
 import org.apache.iceberg.ClientPool;
 import org.apache.iceberg.Schema;
 import org.apache.iceberg.SchemaParser;
-import org.apache.iceberg.TableMetadata;
 import org.apache.iceberg.TableProperties;
 import org.apache.iceberg.exceptions.NoSuchIcebergTableException;
 import org.apache.iceberg.io.FileIO;
@@ -150,15 +149,6 @@ interface HiveOperationsBase {
     }
   }
 
-  /**
-   * @deprecated since 1.6.0, will be removed in 1.7.0; Use {@link 
#storageDescriptor(Schema,
-   *     String, boolean)} instead
-   */
-  @Deprecated
-  static StorageDescriptor storageDescriptor(TableMetadata metadata, boolean 
hiveEngineEnabled) {
-    return storageDescriptor(metadata.schema(), metadata.location(), 
hiveEngineEnabled);
-  }
-
   static StorageDescriptor storageDescriptor(
       Schema schema, String location, boolean hiveEngineEnabled) {
     final StorageDescriptor storageDescriptor = new StorageDescriptor();

Reply via email to