Skip to content

Commit

Permalink
API: Expose table statistics in Table API (#4741)
Browse files Browse the repository at this point in the history
  • Loading branch information
findepi authored Sep 29, 2022
1 parent 61b131f commit ae8e669
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .palantir/revapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
7 changes: 7 additions & 0 deletions api/src/main/java/org/apache/iceberg/Table.java
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,13 @@ default UpdateStatistics updateStatistics() {
/** 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
*
Expand Down
6 changes: 6 additions & 0 deletions core/src/main/java/org/apache/iceberg/BaseMetadataTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;

Expand Down Expand Up @@ -161,6 +162,11 @@ public List<HistoryEntry> history() {
return table().history();
}

@Override
public List<StatisticsFile> statisticsFiles() {
return ImmutableList.of();
}

@Override
public Map<String, SnapshotRef> refs() {
return table().refs();
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/apache/iceberg/BaseTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,11 @@ public LocationProvider locationProvider() {
return operations().locationProvider();
}

@Override
public List<StatisticsFile> statisticsFiles() {
return ops.current().statisticsFiles();
}

@Override
public Map<String, SnapshotRef> refs() {
return ops.current().refs();
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/apache/iceberg/BaseTransaction.java
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,11 @@ public LocationProvider locationProvider() {
return transactionOps.locationProvider();
}

@Override
public List<StatisticsFile> statisticsFiles() {
return current.statisticsFiles();
}

@Override
public Map<String, SnapshotRef> refs() {
return current.refs();
Expand Down
5 changes: 5 additions & 0 deletions core/src/main/java/org/apache/iceberg/SerializableTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,11 @@ public LocationProvider locationProvider() {
return locationProvider;
}

@Override
public List<StatisticsFile> statisticsFiles() {
return lazyTable().statisticsFiles();
}

@Override
public Map<String, SnapshotRef> refs() {
return refs;
Expand Down

0 comments on commit ae8e669

Please sign in to comment.