This is an automated email from the ASF dual-hosted git repository.
blue pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iceberg.git
The following commit(s) were added to refs/heads/master by this push:
new ae8e6698ff API: Expose table statistics in Table API (#4741)
ae8e6698ff is described below
commit ae8e6698ff96f796850068ef8162df0f628ed7e6
Author: Piotr Findeisen <[email protected]>
AuthorDate: Thu Sep 29 23:56:48 2022 +0200
API: Expose table statistics in Table API (#4741)
---
.palantir/revapi.yml | 3 +++
api/src/main/java/org/apache/iceberg/Table.java | 7 +++++++
core/src/main/java/org/apache/iceberg/BaseMetadataTable.java | 6 ++++++
core/src/main/java/org/apache/iceberg/BaseTable.java | 5 +++++
core/src/main/java/org/apache/iceberg/BaseTransaction.java | 5 +++++
core/src/main/java/org/apache/iceberg/SerializableTable.java | 5 +++++
6 files changed, 31 insertions(+)
diff --git a/.palantir/revapi.yml b/.palantir/revapi.yml
index eba74c03a2..d6f09d177d 100644
--- a/.palantir/revapi.yml
+++ b/.palantir/revapi.yml
@@ -13,6 +13,9 @@ acceptedBreaks:
- code: "java.method.addedToInterface"
new: "method java.lang.String
org.apache.iceberg.expressions.Reference<T>::name()"
justification: "All subclasses implement name"
+ - code: "java.method.addedToInterface"
+ new: "method java.util.List<org.apache.iceberg.StatisticsFile>
org.apache.iceberg.Table::statisticsFiles()"
+ justification: "new API method"
- code: "java.method.removed"
old: "method java.lang.Iterable<org.apache.iceberg.DataFile>
org.apache.iceberg.Snapshot::addedFiles()"
justification: "Deprecations for 1.0 release"
diff --git a/api/src/main/java/org/apache/iceberg/Table.java
b/api/src/main/java/org/apache/iceberg/Table.java
index 3f753a3bd2..e17702f366 100644
--- a/api/src/main/java/org/apache/iceberg/Table.java
+++ b/api/src/main/java/org/apache/iceberg/Table.java
@@ -308,6 +308,13 @@ public interface Table {
/** Returns a {@link LocationProvider} to provide locations for new data
files. */
LocationProvider locationProvider();
+ /**
+ * Returns the current statistics files for the table
+ *
+ * @return the current statistics files for the table
+ */
+ List<StatisticsFile> statisticsFiles();
+
/**
* Returns the current refs for the table
*
diff --git a/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java
b/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java
index 31890843f2..d14878d5bb 100644
--- a/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java
+++ b/core/src/main/java/org/apache/iceberg/BaseMetadataTable.java
@@ -24,6 +24,7 @@ import java.util.Map;
import org.apache.iceberg.encryption.EncryptionManager;
import org.apache.iceberg.io.FileIO;
import org.apache.iceberg.io.LocationProvider;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
import org.apache.iceberg.transforms.Transforms;
@@ -161,6 +162,11 @@ public abstract class BaseMetadataTable implements Table,
HasTableOperations, Se
return table().history();
}
+ @Override
+ public List<StatisticsFile> statisticsFiles() {
+ return ImmutableList.of();
+ }
+
@Override
public Map<String, SnapshotRef> refs() {
return table().refs();
diff --git a/core/src/main/java/org/apache/iceberg/BaseTable.java
b/core/src/main/java/org/apache/iceberg/BaseTable.java
index 9b985b7ce7..dc796e3402 100644
--- a/core/src/main/java/org/apache/iceberg/BaseTable.java
+++ b/core/src/main/java/org/apache/iceberg/BaseTable.java
@@ -244,6 +244,11 @@ public class BaseTable implements Table,
HasTableOperations, Serializable {
return operations().locationProvider();
}
+ @Override
+ public List<StatisticsFile> statisticsFiles() {
+ return ops.current().statisticsFiles();
+ }
+
@Override
public Map<String, SnapshotRef> refs() {
return ops.current().refs();
diff --git a/core/src/main/java/org/apache/iceberg/BaseTransaction.java
b/core/src/main/java/org/apache/iceberg/BaseTransaction.java
index 6b3ec1c94e..241738feda 100644
--- a/core/src/main/java/org/apache/iceberg/BaseTransaction.java
+++ b/core/src/main/java/org/apache/iceberg/BaseTransaction.java
@@ -755,6 +755,11 @@ public class BaseTransaction implements Transaction {
return transactionOps.locationProvider();
}
+ @Override
+ public List<StatisticsFile> statisticsFiles() {
+ return current.statisticsFiles();
+ }
+
@Override
public Map<String, SnapshotRef> refs() {
return current.refs();
diff --git a/core/src/main/java/org/apache/iceberg/SerializableTable.java
b/core/src/main/java/org/apache/iceberg/SerializableTable.java
index 8f8f27a761..9b441113e7 100644
--- a/core/src/main/java/org/apache/iceberg/SerializableTable.java
+++ b/core/src/main/java/org/apache/iceberg/SerializableTable.java
@@ -237,6 +237,11 @@ public class SerializableTable implements Table,
Serializable {
return locationProvider;
}
+ @Override
+ public List<StatisticsFile> statisticsFiles() {
+ return lazyTable().statisticsFiles();
+ }
+
@Override
public Map<String, SnapshotRef> refs() {
return refs;