-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
Is your feature request related to a problem or challenge?
The current ColumnStatistics structure is not able to represent nested types (e.g., list, map, or struct) for which statistics are present in Parquet data sources and perhaps others as well.
datafusion/datafusion/common/src/stats.rs
Lines 724 to 752 in d025869
| /// Statistics for a column within a relation | |
| #[derive(Clone, Debug, PartialEq, Eq, Default)] | |
| pub struct ColumnStatistics { | |
| /// Number of null values on column | |
| pub null_count: Precision<usize>, | |
| /// Maximum value of column | |
| pub max_value: Precision<ScalarValue>, | |
| /// Minimum value of column | |
| pub min_value: Precision<ScalarValue>, | |
| /// Sum value of a column | |
| pub sum_value: Precision<ScalarValue>, | |
| /// Number of distinct values | |
| pub distinct_count: Precision<usize>, | |
| /// Estimated size of this column's data in bytes for the output. | |
| /// | |
| /// Note that this is not the same as the total bytes that may be scanned, | |
| /// processed, etc. | |
| /// | |
| /// E.g. we may read 1GB of data from a Parquet file but the Arrow data | |
| /// the node produces may be 2GB; it's this 2GB that is tracked here. | |
| /// | |
| /// Currently this is accurately calculated for primitive types only. | |
| /// For complex types (like Utf8, List, Struct, etc), this value may be | |
| /// absent or inexact (e.g. estimated from the size of the data in the source Parquet files). | |
| /// | |
| /// This value is automatically scaled when operations like limits or | |
| /// filters reduce the number of rows (see [`Statistics::with_fetch`]). | |
| pub byte_size: Precision<usize>, | |
| } |
In addition to list/struct/map statistics, the Statistics struct can't represent statistics for extension types. Three extension types for which we can get statistics from Parquet files are geometry, geography, and variant; however, there is no place to put them in the Statistics so they are dropped.
One approach for doing this is in #20589 , although I wonder if something dynamic could work as well (e.g., a trait with methods for the transformations that are currently hard coded for a fixed set of types).
Describe the solution you'd like
No response
Describe alternatives you've considered
No response
Additional context
No response