Skip to content

Optimize count(col) using table statistics #904

@Dandandan

Description

@Dandandan

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

If both the number of rows and the number of nulls are available as statistic, we can compute the value based on statistics only when reading.
row_count - null_count(row)

Describe the solution you'd like
Add an optimization rule that matches this count expression with column and use the statistics to replace it with the value.

Describe alternatives you've considered

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestperformanceMake DataFusion faster

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions