Skip to content

Nested types and extension types are not supported in Statistics / ColumnStatistics #20707

@paleolimbot

Description

@paleolimbot

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.

/// 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions