Skip to content

support Dictionary types in approx_distinct #24730

Description

@Rich-T-kid

Is your feature request related to a problem or challenge?

approx_distinct returns a not implemented error when the input column has a Dictionary type (e.g. Dictionary(Int32, Utf8)), which is common for low-cardinality string columns stored in Parquet or produced by joins/filters.
Today
SELECT approx_distinct(dict_col) FROM t;
Error: Support for 'approx_distinct' for data type Dictionary(Int32, Utf8) is not implemented

Describe the solution you'd like

approx_distinct uses create_hashes internally (via HLLAccumulator and HllGroupsAccumulator), which already handles Dictionary arrays correctly by hashing the logical decoded values. The fix is to route Dictionary(_, _) to HLLAccumulator

Describe alternatives you've considered

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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