rdblue commented on code in PR #18585: URL: https://github.com/apache/iceberg/pull/18585#discussion_r4342293009
########## format/spec.md: ########## @@ -1011,12 +1012,35 @@ For example, stats for an optional `geometry` field named `location` with field- 10_804: optional long value_count; 10_805: optional long null_value_count; 10_807: optional long total_bytes; - // tight_bounds and nan_value_count are omitted for geo types + // nan_value_count is omitted for geo types } ``` For `variant`, both bounds are unshredded `variant` that store variant field bounds by normalized JSON paths as field names. See [Bounds for Variant](#bounds-for-variant) for details on producing these bounds. +<a id="stats-tightness"></a> +###### Stats Tightness + +Statistics are *tight* when they are exact for the live rows of a file: + +* Bounds are the minimum and maximum of the live values. +* `null_value_count` and `nan_value_count` are the counts across the live rows. + +`value_count` and `total_bytes` are not part of tightness. `value_count` is the number of values across all rows written to the file and is not adjusted when rows are deleted; for a field with no repeated (`list` or `map`) ancestor, the live value count is `value_count` minus the deletion vector's cardinality. `total_bytes` is an estimate and is likewise not adjusted for deleted rows. Review Comment: Following up here, we realized that this has a negative impact on filtering. Updating `null_value_count` but not `value_count` makes the filtering logic dependent on both `dv.cardinality()` and the `tight_stats` field being true. We've decided that it isn't worth the optimization of not updating `value_count` so we are adding it back to `tight_stats`. There's a more detailed write-up here for anyone interested: https://gist.github.com/rdblue/65314d6378e3de517a421d57c9da00e1 -- 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]
