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 580e793ef2 Core, Spark: Rename RequiresRemoteScanPlanning to
SupportsDistributedScanPlanning (#15184)
580e793ef2 is described below
commit 580e793ef220404236177935e6ee94d1ccfe4668
Author: Eduard Tudenhoefner <[email protected]>
AuthorDate: Wed Feb 11 17:50:59 2026 +0100
Core, Spark: Rename RequiresRemoteScanPlanning to
SupportsDistributedScanPlanning (#15184)
---
core/src/main/java/org/apache/iceberg/BaseTable.java | 3 ++-
...oteScanPlanning.java => SupportsDistributedScanPlanning.java} | 8 ++++++--
core/src/main/java/org/apache/iceberg/rest/RESTTable.java | 9 +++++++--
.../src/main/java/org/apache/iceberg/spark/SparkReadConf.java | 5 ++++-
.../java/org/apache/iceberg/spark/source/SparkScanBuilder.java | 5 +----
.../src/main/java/org/apache/iceberg/spark/SparkReadConf.java | 5 ++++-
.../java/org/apache/iceberg/spark/source/SparkScanBuilder.java | 5 +----
.../src/main/java/org/apache/iceberg/spark/SparkReadConf.java | 5 ++++-
.../java/org/apache/iceberg/spark/source/SparkScanBuilder.java | 5 +----
.../src/main/java/org/apache/iceberg/spark/SparkReadConf.java | 5 ++++-
.../java/org/apache/iceberg/spark/source/SparkScanBuilder.java | 5 +----
11 files changed, 35 insertions(+), 25 deletions(-)
diff --git a/core/src/main/java/org/apache/iceberg/BaseTable.java
b/core/src/main/java/org/apache/iceberg/BaseTable.java
index c489c3bfb5..67f9f41afb 100644
--- a/core/src/main/java/org/apache/iceberg/BaseTable.java
+++ b/core/src/main/java/org/apache/iceberg/BaseTable.java
@@ -38,7 +38,8 @@ import
org.apache.iceberg.relocated.com.google.common.base.Preconditions;
* BaseTable using a {@link StaticTableOperations}. This way no Catalog
related calls are needed
* when reading the table data after deserialization.
*/
-public class BaseTable implements Table, HasTableOperations, Serializable {
+public class BaseTable
+ implements Table, HasTableOperations, Serializable,
SupportsDistributedScanPlanning {
private final TableOperations ops;
private final String name;
private final MetricsReporter reporter;
diff --git
a/core/src/main/java/org/apache/iceberg/RequiresRemoteScanPlanning.java
b/core/src/main/java/org/apache/iceberg/SupportsDistributedScanPlanning.java
similarity index 80%
rename from
core/src/main/java/org/apache/iceberg/RequiresRemoteScanPlanning.java
rename to
core/src/main/java/org/apache/iceberg/SupportsDistributedScanPlanning.java
index 440ea70007..6761698951 100644
--- a/core/src/main/java/org/apache/iceberg/RequiresRemoteScanPlanning.java
+++ b/core/src/main/java/org/apache/iceberg/SupportsDistributedScanPlanning.java
@@ -18,5 +18,9 @@
*/
package org.apache.iceberg;
-/** Marker interface to indicate whether a Table requires remote scan planning
*/
-public interface RequiresRemoteScanPlanning {}
+/** Interface to indicate whether a Table supports distributed scan planning */
+public interface SupportsDistributedScanPlanning {
+ default boolean allowDistributedPlanning() {
+ return true;
+ }
+}
diff --git a/core/src/main/java/org/apache/iceberg/rest/RESTTable.java
b/core/src/main/java/org/apache/iceberg/rest/RESTTable.java
index 8be5590bfa..26b694b50c 100644
--- a/core/src/main/java/org/apache/iceberg/rest/RESTTable.java
+++ b/core/src/main/java/org/apache/iceberg/rest/RESTTable.java
@@ -25,13 +25,13 @@ import org.apache.iceberg.BaseTable;
import org.apache.iceberg.BatchScan;
import org.apache.iceberg.BatchScanAdapter;
import org.apache.iceberg.ImmutableTableScanContext;
-import org.apache.iceberg.RequiresRemoteScanPlanning;
+import org.apache.iceberg.SupportsDistributedScanPlanning;
import org.apache.iceberg.TableOperations;
import org.apache.iceberg.TableScan;
import org.apache.iceberg.catalog.TableIdentifier;
import org.apache.iceberg.metrics.MetricsReporter;
-class RESTTable extends BaseTable implements RequiresRemoteScanPlanning {
+class RESTTable extends BaseTable implements SupportsDistributedScanPlanning {
private final RESTClient client;
private final Supplier<Map<String, String>> headers;
private final MetricsReporter reporter;
@@ -84,4 +84,9 @@ class RESTTable extends BaseTable implements
RequiresRemoteScanPlanning {
public BatchScan newBatchScan() {
return new BatchScanAdapter(newScan());
}
+
+ @Override
+ public boolean allowDistributedPlanning() {
+ return false;
+ }
}
diff --git
a/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
b/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
index dd7e2c20c1..ff2b10ef21 100644
--- a/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
+++ b/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
@@ -22,6 +22,7 @@ import static org.apache.iceberg.PlanningMode.LOCAL;
import java.util.Map;
import org.apache.iceberg.PlanningMode;
+import org.apache.iceberg.SupportsDistributedScanPlanning;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.exceptions.ValidationException;
@@ -296,7 +297,9 @@ public class SparkReadConf {
}
public boolean distributedPlanningEnabled() {
- return dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL;
+ return table instanceof SupportsDistributedScanPlanning distributed
+ && distributed.allowDistributedPlanning()
+ && (dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL);
}
public PlanningMode dataPlanningMode() {
diff --git
a/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
b/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
index dd914f1617..6c24d30e8b 100644
---
a/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
+++
b/spark/v3.4/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
@@ -34,7 +34,6 @@ import org.apache.iceberg.MetadataColumns;
import org.apache.iceberg.MetricsConfig;
import org.apache.iceberg.MetricsModes;
import org.apache.iceberg.PartitionSpec;
-import org.apache.iceberg.RequiresRemoteScanPlanning;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Snapshot;
import org.apache.iceberg.SparkDistributedDataScan;
@@ -761,9 +760,7 @@ public class SparkScanBuilder
}
private BatchScan newBatchScan() {
- if (table instanceof RequiresRemoteScanPlanning) {
- return table.newBatchScan();
- } else if (table instanceof BaseTable &&
readConf.distributedPlanningEnabled()) {
+ if (readConf.distributedPlanningEnabled()) {
return new SparkDistributedDataScan(spark, table, readConf);
} else {
return table.newBatchScan();
diff --git
a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
index 9ea08c3169..e9d28ca853 100644
--- a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
+++ b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
@@ -22,6 +22,7 @@ import static org.apache.iceberg.PlanningMode.LOCAL;
import java.util.Map;
import org.apache.iceberg.PlanningMode;
+import org.apache.iceberg.SupportsDistributedScanPlanning;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.exceptions.ValidationException;
@@ -292,7 +293,9 @@ public class SparkReadConf {
}
public boolean distributedPlanningEnabled() {
- return dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL;
+ return table instanceof SupportsDistributedScanPlanning distributed
+ && distributed.allowDistributedPlanning()
+ && (dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL);
}
public PlanningMode dataPlanningMode() {
diff --git
a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
index dd914f1617..6c24d30e8b 100644
---
a/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
+++
b/spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
@@ -34,7 +34,6 @@ import org.apache.iceberg.MetadataColumns;
import org.apache.iceberg.MetricsConfig;
import org.apache.iceberg.MetricsModes;
import org.apache.iceberg.PartitionSpec;
-import org.apache.iceberg.RequiresRemoteScanPlanning;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Snapshot;
import org.apache.iceberg.SparkDistributedDataScan;
@@ -761,9 +760,7 @@ public class SparkScanBuilder
}
private BatchScan newBatchScan() {
- if (table instanceof RequiresRemoteScanPlanning) {
- return table.newBatchScan();
- } else if (table instanceof BaseTable &&
readConf.distributedPlanningEnabled()) {
+ if (readConf.distributedPlanningEnabled()) {
return new SparkDistributedDataScan(spark, table, readConf);
} else {
return table.newBatchScan();
diff --git
a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
index 2788e160d5..420c3517ff 100644
--- a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
+++ b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
@@ -22,6 +22,7 @@ import static org.apache.iceberg.PlanningMode.LOCAL;
import java.util.Map;
import org.apache.iceberg.PlanningMode;
+import org.apache.iceberg.SupportsDistributedScanPlanning;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.exceptions.ValidationException;
@@ -292,7 +293,9 @@ public class SparkReadConf {
}
public boolean distributedPlanningEnabled() {
- return dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL;
+ return table instanceof SupportsDistributedScanPlanning distributed
+ && distributed.allowDistributedPlanning()
+ && (dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL);
}
public PlanningMode dataPlanningMode() {
diff --git
a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
index dd914f1617..6c24d30e8b 100644
---
a/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
+++
b/spark/v4.0/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
@@ -34,7 +34,6 @@ import org.apache.iceberg.MetadataColumns;
import org.apache.iceberg.MetricsConfig;
import org.apache.iceberg.MetricsModes;
import org.apache.iceberg.PartitionSpec;
-import org.apache.iceberg.RequiresRemoteScanPlanning;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Snapshot;
import org.apache.iceberg.SparkDistributedDataScan;
@@ -761,9 +760,7 @@ public class SparkScanBuilder
}
private BatchScan newBatchScan() {
- if (table instanceof RequiresRemoteScanPlanning) {
- return table.newBatchScan();
- } else if (table instanceof BaseTable &&
readConf.distributedPlanningEnabled()) {
+ if (readConf.distributedPlanningEnabled()) {
return new SparkDistributedDataScan(spark, table, readConf);
} else {
return table.newBatchScan();
diff --git
a/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
b/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
index 2788e160d5..420c3517ff 100644
--- a/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
+++ b/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkReadConf.java
@@ -22,6 +22,7 @@ import static org.apache.iceberg.PlanningMode.LOCAL;
import java.util.Map;
import org.apache.iceberg.PlanningMode;
+import org.apache.iceberg.SupportsDistributedScanPlanning;
import org.apache.iceberg.Table;
import org.apache.iceberg.TableProperties;
import org.apache.iceberg.exceptions.ValidationException;
@@ -292,7 +293,9 @@ public class SparkReadConf {
}
public boolean distributedPlanningEnabled() {
- return dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL;
+ return table instanceof SupportsDistributedScanPlanning distributed
+ && distributed.allowDistributedPlanning()
+ && (dataPlanningMode() != LOCAL || deletePlanningMode() != LOCAL);
}
public PlanningMode dataPlanningMode() {
diff --git
a/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
b/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
index 744d9f28a9..cd4945c975 100644
---
a/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
+++
b/spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/SparkScanBuilder.java
@@ -33,7 +33,6 @@ import org.apache.iceberg.IncrementalChangelogScan;
import org.apache.iceberg.MetadataColumns;
import org.apache.iceberg.MetricsConfig;
import org.apache.iceberg.MetricsModes;
-import org.apache.iceberg.RequiresRemoteScanPlanning;
import org.apache.iceberg.Schema;
import org.apache.iceberg.Snapshot;
import org.apache.iceberg.SparkDistributedDataScan;
@@ -753,9 +752,7 @@ public class SparkScanBuilder
}
private BatchScan newBatchScan() {
- if (table instanceof RequiresRemoteScanPlanning) {
- return table.newBatchScan();
- } else if (table instanceof BaseTable &&
readConf.distributedPlanningEnabled()) {
+ if (readConf.distributedPlanningEnabled()) {
return new SparkDistributedDataScan(spark, table, readConf);
} else {
return table.newBatchScan();