findepi commented on code in PR #10659:
URL: https://github.com/apache/iceberg/pull/10659#discussion_r1676177423
##########
spark/v3.5/spark/src/main/java/org/apache/iceberg/spark/source/SparkScan.java:
##########
@@ -175,7 +181,25 @@ public Statistics estimateStatistics() {
protected Statistics estimateStatistics(Snapshot snapshot) {
// its a fresh table, no data
if (snapshot == null) {
- return new Stats(0L, 0L);
+ return new Stats(0L, 0L, Maps.newHashMap());
+ }
+
+ Map<NamedReference, ColumnStatistics> map = Maps.newHashMap();
+
+ if (readConf.enableColumnStats()) {
+ List<StatisticsFile> files = table.statisticsFiles();
+ if (!files.isEmpty()) {
+ List<BlobMetadata> metadataList = (files.get(0)).blobMetadata();
Review Comment:
> Also from
[code](https://github.com/apache/iceberg/blob/main/core/src/main/java/org/apache/iceberg/TableMetadata.java#L886),
`org.apache.iceberg.TableMetadata.Builder#statisticsFiles` is a map of
snaphotId to List of statistics file.
yes, we can't enforce 1-1 mapping on the JSON level and we don't want the
builder to fail when parsing metadata json.
> May be we should make the 1x1 mapping(between snapshot and stats file)
clear in the spec
indeed spec doesn't mention anything like this.
this is "enforced" in
`org.apache.iceberg.TableMetadata.Builder#setStatistics`
improving the spec sounds like a good idea
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]