diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml
index 5ac91ec0a96f..1ae35cf64d0a 100644
--- a/.palantir/revapi.yml
+++ b/.palantir/revapi.yml
@@ -745,6 +745,30 @@ acceptedBreaks:
\ of type erasure and the original type is always returned"
"1.3.0":
org.apache.iceberg:iceberg-api:
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableDeleteOrphanFiles"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableDeleteReachableFiles"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableExpireSnapshots"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableMigrateTable"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableRewriteDataFiles"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableRewriteManifests"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableRewritePositionDeleteFiles"
+ justification: "Moving from iceberg-api to iceberg-core"
+ - code: "java.class.removed"
+ old: "class org.apache.iceberg.actions.ImmutableSnapshotTable"
+ justification: "Moving from iceberg-api to iceberg-core"
- code: "java.class.removed"
old: "class org.apache.iceberg.view.ImmutableSQLViewRepresentation"
justification: "Moving from iceberg-api to iceberg-core"
diff --git a/api/src/main/java/org/apache/iceberg/actions/DeleteOrphanFiles.java b/api/src/main/java/org/apache/iceberg/actions/DeleteOrphanFiles.java
index a57da3bed098..4e8f80fa833f 100644
--- a/api/src/main/java/org/apache/iceberg/actions/DeleteOrphanFiles.java
+++ b/api/src/main/java/org/apache/iceberg/actions/DeleteOrphanFiles.java
@@ -24,7 +24,6 @@
import java.util.function.Consumer;
import org.apache.iceberg.io.SupportsBulkOperations;
import org.apache.iceberg.relocated.com.google.common.base.Preconditions;
-import org.immutables.value.Value;
/**
* An action that deletes orphan metadata, data and delete files in a table.
@@ -32,7 +31,6 @@
*
A file is considered orphan if it is not reachable by any valid snapshot. The set of actual
* files is built by listing the underlying storage which makes this operation expensive.
*/
-@Value.Enclosing
public interface DeleteOrphanFiles extends Action {
/**
* Passes a location which should be scanned for orphan files.
@@ -141,7 +139,6 @@ default DeleteOrphanFiles equalAuthorities(Map newEqualAuthoriti
}
/** The action result that contains a summary of the execution. */
- @Value.Immutable
interface Result {
/** Returns locations of orphan files. */
Iterable orphanFileLocations();
diff --git a/api/src/main/java/org/apache/iceberg/actions/DeleteReachableFiles.java b/api/src/main/java/org/apache/iceberg/actions/DeleteReachableFiles.java
index e8110284954f..d4ebb5a2007c 100644
--- a/api/src/main/java/org/apache/iceberg/actions/DeleteReachableFiles.java
+++ b/api/src/main/java/org/apache/iceberg/actions/DeleteReachableFiles.java
@@ -22,7 +22,6 @@
import java.util.function.Consumer;
import org.apache.iceberg.io.FileIO;
import org.apache.iceberg.io.SupportsBulkOperations;
-import org.immutables.value.Value;
/**
* An action that deletes all files referenced by a table metadata file.
@@ -33,7 +32,6 @@
*
* Implementations may use a query engine to distribute parts of work.
*/
-@Value.Enclosing
public interface DeleteReachableFiles
extends Action {
@@ -67,7 +65,6 @@ public interface DeleteReachableFiles
DeleteReachableFiles io(FileIO io);
/** The action result that contains a summary of the execution. */
- @Value.Immutable
interface Result {
/** Returns the number of deleted data files. */
diff --git a/api/src/main/java/org/apache/iceberg/actions/ExpireSnapshots.java b/api/src/main/java/org/apache/iceberg/actions/ExpireSnapshots.java
index 286ab115d14f..610d2d97248e 100644
--- a/api/src/main/java/org/apache/iceberg/actions/ExpireSnapshots.java
+++ b/api/src/main/java/org/apache/iceberg/actions/ExpireSnapshots.java
@@ -22,7 +22,6 @@
import java.util.function.Consumer;
import org.apache.iceberg.Snapshot;
import org.apache.iceberg.io.SupportsBulkOperations;
-import org.immutables.value.Value;
/**
* An action that expires snapshots in a table.
@@ -30,7 +29,6 @@
* Similar to {@link org.apache.iceberg.ExpireSnapshots} but may use a query engine to distribute
* parts of the work.
*/
-@Value.Enclosing
public interface ExpireSnapshots extends Action {
/**
* Expires a specific {@link Snapshot} identified by id.
@@ -100,7 +98,6 @@ public interface ExpireSnapshots extends Action {
/**
* Sets table properties in the newly created Iceberg table. Any properties with the same key name
@@ -53,7 +51,6 @@ default MigrateTable dropBackup() {
}
/** The action result that contains a summary of the execution. */
- @Value.Immutable
interface Result {
/** Returns the number of migrated data files. */
long migratedDataFilesCount();
diff --git a/api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java b/api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java
index 20e75159b1e8..854b0993513e 100644
--- a/api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java
+++ b/api/src/main/java/org/apache/iceberg/actions/RewriteDataFiles.java
@@ -24,13 +24,11 @@
import org.apache.iceberg.StructLike;
import org.apache.iceberg.expressions.Expression;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
-import org.immutables.value.Value;
/**
* An action for rewriting data files according to a rewrite strategy. Generally used for optimizing
* the sizing and layout of data files within a table.
*/
-@Value.Enclosing
public interface RewriteDataFiles
extends SnapshotUpdate {
@@ -178,33 +176,27 @@ default RewriteDataFiles zOrder(String... columns) {
* null then that particular file group failed. We should only have failed groups if partial
* progress is enabled otherwise we will report a total failure for the job.
*/
- @Value.Immutable
interface Result {
List rewriteResults();
- @Value.Default
default List rewriteFailures() {
return ImmutableList.of();
}
- @Value.Default
default int addedDataFilesCount() {
return rewriteResults().stream().mapToInt(FileGroupRewriteResult::addedDataFilesCount).sum();
}
- @Value.Default
default int rewrittenDataFilesCount() {
return rewriteResults().stream()
.mapToInt(FileGroupRewriteResult::rewrittenDataFilesCount)
.sum();
}
- @Value.Default
default long rewrittenBytesCount() {
return rewriteResults().stream().mapToLong(FileGroupRewriteResult::rewrittenBytesCount).sum();
}
- @Value.Default
default int failedDataFilesCount() {
return rewriteFailures().stream().mapToInt(FileGroupFailureResult::dataFilesCount).sum();
}
@@ -214,7 +206,6 @@ default int failedDataFilesCount() {
* For a particular file group, the number of files which are newly created and the number of
* files which were formerly part of the table but have been rewritten.
*/
- @Value.Immutable
interface FileGroupRewriteResult {
FileGroupInfo info();
@@ -222,14 +213,12 @@ interface FileGroupRewriteResult {
int rewrittenDataFilesCount();
- @Value.Default
default long rewrittenBytesCount() {
return 0L;
}
}
/** For a file group that failed to rewrite. */
- @Value.Immutable
interface FileGroupFailureResult {
FileGroupInfo info();
@@ -240,7 +229,6 @@ interface FileGroupFailureResult {
* A description of a file group, when it was processed, and within which partition. For use
* tracking rewrite operations and for returning results.
*/
- @Value.Immutable
interface FileGroupInfo {
/** returns which file group this is out of the total set of file groups for this rewrite */
diff --git a/api/src/main/java/org/apache/iceberg/actions/RewriteManifests.java b/api/src/main/java/org/apache/iceberg/actions/RewriteManifests.java
index 836ec6d4a726..57b35aaf6596 100644
--- a/api/src/main/java/org/apache/iceberg/actions/RewriteManifests.java
+++ b/api/src/main/java/org/apache/iceberg/actions/RewriteManifests.java
@@ -20,10 +20,8 @@
import java.util.function.Predicate;
import org.apache.iceberg.ManifestFile;
-import org.immutables.value.Value;
/** An action that rewrites manifests. */
-@Value.Enclosing
public interface RewriteManifests
extends SnapshotUpdate {
/**
@@ -57,7 +55,6 @@ public interface RewriteManifests
RewriteManifests stagingLocation(String stagingLocation);
/** The action result that contains a summary of the execution. */
- @Value.Immutable
interface Result {
/** Returns rewritten manifests. */
Iterable rewrittenManifests();
diff --git a/api/src/main/java/org/apache/iceberg/actions/RewritePositionDeleteFiles.java b/api/src/main/java/org/apache/iceberg/actions/RewritePositionDeleteFiles.java
index 96548ae07bee..0c05433a8b96 100644
--- a/api/src/main/java/org/apache/iceberg/actions/RewritePositionDeleteFiles.java
+++ b/api/src/main/java/org/apache/iceberg/actions/RewritePositionDeleteFiles.java
@@ -22,14 +22,12 @@
import org.apache.iceberg.RewriteJobOrder;
import org.apache.iceberg.StructLike;
import org.apache.iceberg.expressions.Expression;
-import org.immutables.value.Value;
/**
* An action for rewriting position delete files.
*
* Generally used for optimizing the size and layout of position delete files within a table.
*/
-@Value.Enclosing
public interface RewritePositionDeleteFiles
extends SnapshotUpdate {
@@ -93,7 +91,6 @@ public interface RewritePositionDeleteFiles
RewritePositionDeleteFiles filter(Expression expression);
/** The action result that contains a summary of the execution. */
- @Value.Immutable
interface Result {
List rewriteResults();
@@ -127,7 +124,6 @@ default long addedBytesCount() {
* newly created and the number of files which were formerly part of the table but have been
* rewritten.
*/
- @Value.Immutable
interface FileGroupRewriteResult {
/** Description of this position delete file group. */
FileGroupInfo info();
@@ -149,7 +145,6 @@ interface FileGroupRewriteResult {
* A description of a position delete file group, when it was processed, and within which
* partition. For use tracking rewrite operations and for returning results.
*/
- @Value.Immutable
interface FileGroupInfo {
/**
* Returns which position delete file group this is out of the total set of file groups for this
diff --git a/api/src/main/java/org/apache/iceberg/actions/SnapshotTable.java b/api/src/main/java/org/apache/iceberg/actions/SnapshotTable.java
index d009ed0e18f1..37c600ab0392 100644
--- a/api/src/main/java/org/apache/iceberg/actions/SnapshotTable.java
+++ b/api/src/main/java/org/apache/iceberg/actions/SnapshotTable.java
@@ -19,10 +19,8 @@
package org.apache.iceberg.actions;
import java.util.Map;
-import org.immutables.value.Value;
/** An action that creates an independent snapshot of an existing table. */
-@Value.Enclosing
public interface SnapshotTable extends Action {
/**
* Sets the table identifier for the newly created Iceberg table.
@@ -60,7 +58,6 @@ public interface SnapshotTable extends Action rewriteFailures() {
+ return RewriteDataFiles.Result.super.rewriteFailures();
+ }
+
+ @Override
+ @Value.Default
+ default int addedDataFilesCount() {
+ return RewriteDataFiles.Result.super.addedDataFilesCount();
+ }
+
+ @Override
+ @Value.Default
+ default int rewrittenDataFilesCount() {
+ return RewriteDataFiles.Result.super.rewrittenDataFilesCount();
+ }
+
+ @Override
+ @Value.Default
+ default long rewrittenBytesCount() {
+ return RewriteDataFiles.Result.super.rewrittenBytesCount();
+ }
+
+ @Override
+ @Value.Default
+ default int failedDataFilesCount() {
+ return RewriteDataFiles.Result.super.failedDataFilesCount();
+ }
+ }
+
+ @Value.Immutable
+ interface FileGroupRewriteResult extends RewriteDataFiles.FileGroupRewriteResult {
+ @Override
+ @Value.Default
+ default long rewrittenBytesCount() {
+ return RewriteDataFiles.FileGroupRewriteResult.super.rewrittenBytesCount();
+ }
+ }
+
+ @Value.Immutable
+ interface FileGroupFailureResult extends RewriteDataFiles.FileGroupFailureResult {}
+
+ @Value.Immutable
+ interface FileGroupInfo extends RewriteDataFiles.FileGroupInfo {}
+}
diff --git a/core/src/main/java/org/apache/iceberg/actions/BaseRewriteManifests.java b/core/src/main/java/org/apache/iceberg/actions/BaseRewriteManifests.java
new file mode 100644
index 000000000000..63e1e4d450d7
--- /dev/null
+++ b/core/src/main/java/org/apache/iceberg/actions/BaseRewriteManifests.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.actions;
+
+import org.immutables.value.Value;
+import org.immutables.value.Value.Style.BuilderVisibility;
+import org.immutables.value.Value.Style.ImplementationVisibility;
+
+@Value.Enclosing
+@SuppressWarnings("ImmutablesStyle")
+@Value.Style(
+ typeImmutableEnclosing = "ImmutableRewriteManifests",
+ visibility = ImplementationVisibility.PUBLIC,
+ builderVisibility = BuilderVisibility.PUBLIC)
+interface BaseRewriteManifests extends RewriteManifests {
+
+ @Value.Immutable
+ interface Result extends RewriteManifests.Result {}
+}
diff --git a/core/src/main/java/org/apache/iceberg/actions/BaseRewritePositionalDeleteFiles.java b/core/src/main/java/org/apache/iceberg/actions/BaseRewritePositionalDeleteFiles.java
new file mode 100644
index 000000000000..6732ef6c0f6a
--- /dev/null
+++ b/core/src/main/java/org/apache/iceberg/actions/BaseRewritePositionalDeleteFiles.java
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.actions;
+
+import org.immutables.value.Value;
+import org.immutables.value.Value.Style.BuilderVisibility;
+import org.immutables.value.Value.Style.ImplementationVisibility;
+
+@Value.Enclosing
+@SuppressWarnings("ImmutablesStyle")
+@Value.Style(
+ typeImmutableEnclosing = "ImmutableRewritePositionDeleteFiles",
+ visibility = ImplementationVisibility.PUBLIC,
+ builderVisibility = BuilderVisibility.PUBLIC)
+interface BaseRewritePositionalDeleteFiles extends RewritePositionDeleteFiles {
+
+ @Value.Immutable
+ interface Result extends RewritePositionDeleteFiles.Result {
+ @Override
+ @Value.Default
+ default int rewrittenDeleteFilesCount() {
+ return RewritePositionDeleteFiles.Result.super.rewrittenDeleteFilesCount();
+ }
+
+ @Override
+ @Value.Default
+ default int addedDeleteFilesCount() {
+ return RewritePositionDeleteFiles.Result.super.addedDeleteFilesCount();
+ }
+
+ @Override
+ @Value.Default
+ default long rewrittenBytesCount() {
+ return RewritePositionDeleteFiles.Result.super.rewrittenBytesCount();
+ }
+
+ @Override
+ @Value.Default
+ default long addedBytesCount() {
+ return RewritePositionDeleteFiles.Result.super.addedBytesCount();
+ }
+ }
+
+ @Value.Immutable
+ interface FileGroupRewriteResult extends RewritePositionDeleteFiles.FileGroupRewriteResult {}
+
+ @Value.Immutable
+ interface FileGroupInfo extends RewritePositionDeleteFiles.FileGroupInfo {}
+}
diff --git a/core/src/main/java/org/apache/iceberg/actions/BaseSnapshotTable.java b/core/src/main/java/org/apache/iceberg/actions/BaseSnapshotTable.java
new file mode 100644
index 000000000000..fb8fbaca3d6e
--- /dev/null
+++ b/core/src/main/java/org/apache/iceberg/actions/BaseSnapshotTable.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.actions;
+
+import org.immutables.value.Value;
+import org.immutables.value.Value.Style.BuilderVisibility;
+import org.immutables.value.Value.Style.ImplementationVisibility;
+
+@Value.Enclosing
+@SuppressWarnings("ImmutablesStyle")
+@Value.Style(
+ typeImmutableEnclosing = "ImmutableSnapshotTable",
+ visibility = ImplementationVisibility.PUBLIC,
+ builderVisibility = BuilderVisibility.PUBLIC)
+interface BaseSnapshotTable extends SnapshotTable {
+
+ @Value.Immutable
+ interface Result extends SnapshotTable.Result {}
+}
diff --git a/core/src/main/java/org/apache/iceberg/view/BaseViewHistoryEntry.java b/core/src/main/java/org/apache/iceberg/view/BaseViewHistoryEntry.java
index 0562af5f7fad..3ce28142ea10 100644
--- a/core/src/main/java/org/apache/iceberg/view/BaseViewHistoryEntry.java
+++ b/core/src/main/java/org/apache/iceberg/view/BaseViewHistoryEntry.java
@@ -19,6 +19,8 @@
package org.apache.iceberg.view;
import org.immutables.value.Value;
+import org.immutables.value.Value.Style.BuilderVisibility;
+import org.immutables.value.Value.Style.ImplementationVisibility;
/**
* View history entry.
@@ -27,8 +29,9 @@
* set to the given version ID.
*/
@Value.Immutable
-// https://github.com/immutables/immutables/issues/291 does not apply here because we're not adding
-// any Immutable-specific class to the classpath
@SuppressWarnings("ImmutablesStyle")
-@Value.Style(typeImmutable = "ImmutableViewHistoryEntry")
-public interface BaseViewHistoryEntry extends ViewHistoryEntry {}
+@Value.Style(
+ typeImmutable = "ImmutableViewHistoryEntry",
+ visibility = ImplementationVisibility.PUBLIC,
+ builderVisibility = BuilderVisibility.PUBLIC)
+interface BaseViewHistoryEntry extends ViewHistoryEntry {}
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 ca6c2dfc286a..986628a91157 100644
--- a/core/src/main/java/org/apache/iceberg/view/BaseViewVersion.java
+++ b/core/src/main/java/org/apache/iceberg/view/BaseViewVersion.java
@@ -21,6 +21,8 @@
import javax.annotation.Nullable;
import org.apache.iceberg.catalog.Namespace;
import org.immutables.value.Value;
+import org.immutables.value.Value.Style.BuilderVisibility;
+import org.immutables.value.Value.Style.ImplementationVisibility;
/**
* A version of the view at a point in time.
@@ -30,11 +32,12 @@
* Versions are created by view operations, like Create and Replace.
*/
@Value.Immutable
-// https://github.com/immutables/immutables/issues/291 does not apply here because we're not adding
-// any Immutable-specific class to the classpath
@SuppressWarnings("ImmutablesStyle")
-@Value.Style(typeImmutable = "ImmutableViewVersion")
-public interface BaseViewVersion extends ViewVersion {
+@Value.Style(
+ typeImmutable = "ImmutableViewVersion",
+ visibility = ImplementationVisibility.PUBLIC,
+ builderVisibility = BuilderVisibility.PUBLIC)
+interface BaseViewVersion extends ViewVersion {
@Override
@Value.Lazy