Skip to content

Add support for dictionary for approx_distinct - #24646

Open
mkleen wants to merge 1 commit into
apache:mainfrom
mkleen:dictionary_approx_distinct
Open

Add support for dictionary for approx_distinct#24646
mkleen wants to merge 1 commit into
apache:mainfrom
mkleen:dictionary_approx_distinct

Conversation

@mkleen

@mkleen mkleen commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

  • Support the Arrow type Dictionary for approx_distinct

What changes are included in this PR?

  • Enable HLLAccumulator and HllGroupsAccumulator to support Dictionary
  • Tests

Are these changes tested?

Yes

Are there any user-facing changes?

Yes, approx_distinct supports now Dictionary but no breaking changes.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Aug 25, 2026
@mkleen
mkleen marked this pull request as ready for review August 25, 2026 07:58
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.44%. Comparing base (3ace5a0) to head (a677c96).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24646      +/-   ##
==========================================
- Coverage   81.44%   81.44%   -0.01%     
==========================================
  Files        1118     1118              
  Lines      399560   399560              
  Branches   399560   399560              
==========================================
- Hits       325424   325417       -7     
- Misses      55137    55141       +4     
- Partials    18999    19002       +3     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mkleen

mkleen commented Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

@Jefffrey

@kumarUjjawal kumarUjjawal left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @mkleen this looks good overall. I had two comments please check.

| DataType::Map(_, _)
| DataType::Struct(_)
| DataType::Union(_, _)
| DataType::Dictionary(_, _)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it work to match on the value type instead, so a dictionary is supported exactly when its values would be? Something like DataType::Dictionary(_, value_type)

@mkleen mkleen Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. Floats will be unsupported see #23084, So we should exclude them in all container types.

| DataType::Map(_, _)
| DataType::Struct(_)
| DataType::Union(_, _)
| DataType::Dictionary(_, _)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make sense to have both dictionary arms on the value type, so Dictionary(_, value_type) is accepted only when is_hll_groups_type(value_type) is true?

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

Labels

functions Changes to functions implementation sqllogictest SQL Logic Tests (.slt)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants