Repository navigation
feat: Support Map type in approx_distinct - #23526
Merged
Merged
Conversation
mkleen
force-pushed
the
map_approx_distinct
branch
from
July 13, 2026 08:27
6eab1a7 to
8b235b7
Compare
mkleen
marked this pull request as ready for review
July 13, 2026 08:28
nuno-faria
approved these changes
Jul 13, 2026
nuno-faria
left a comment
Contributor
There was a problem hiding this comment.
Thanks @mkleen, LGTM.
Jefffrey
approved these changes
Jul 14, 2026
Contributor
|
thanks @mkleen & @nuno-faria |
kosiew
pushed a commit
to kosiew/datafusion
that referenced
this pull request
Aug 12, 2026
## Which issue does this PR close? - Relates to apache#22989 but does not close it. More types are coming. ## Rationale for this change - Support the Arrow types `Map` type for `approx_distinct` ## What changes are included in this PR? - Enable `HLLAccumulator` and `HllGroupsAccumulator` to support `Map` - Tests for the non-grouped and grouped path as part of `aggregate.slt` ## Are these changes tested? Yes and results are compared to DuckDB: ``` D CREATE TABLE approx_distinct_map_test AS SELECT * FROM (VALUES (1, MAP {'a': 1, 'b': 2}), (1, MAP {'a': 1, 'b': 2}), (1, MAP {'c': 3}), (2, MAP {'d': 4}), (2, NULL), (3, NULL), (3, NULL), (4, MAP {'e': 5}) ) AS t(g, m); D SELECT approx_count_distinct(m) FROM approx_distinct_map_test WHERE g = 1; ┌──────────────────────────┐ │ approx_count_distinct(m) │ │ int64 │ ├──────────────────────────┤ │ 2 │ └──────────────────────────┘ D SELECT g, approx_count_distinct(m) FROM approx_distinct_map_test GROUP BY g ORDER BY g; ┌───────┬──────────────────────────┐ │ g │ approx_count_distinct(m) │ │ int32 │ int64 │ ├───────┼──────────────────────────┤ │ 1 │ 2 │ │ 2 │ 1 │ │ 3 │ 0 │ │ 4 │ 1 │ └───────┴──────────────────────────┘ D SELECT approx_count_distinct(m) FROM approx_distinct_map_test; ┌──────────────────────────┐ │ approx_count_distinct(m) │ │ int64 │ ├──────────────────────────┤ │ 4 │ └──────────────────────────┘ ``` ## Are there any user-facing changes? Yes, `approx_distinct` supports now `Map` but no breaking changes. Co-authored-by: Nuno Faria <nunofpfaria@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Which issue does this PR close?
approx_distinctfunction #22989 but does not close it. More types are coming.Rationale for this change
Maptype forapprox_distinctWhat changes are included in this PR?
HLLAccumulatorandHllGroupsAccumulatorto supportMapaggregate.sltAre these changes tested?
Yes and results are compared to DuckDB:
Are there any user-facing changes?
Yes,
approx_distinctsupports nowMapbut no breaking changes.