Skip to content

feat: Support RunEndEncoded type in approx_distinct - #25951

Merged
jayzhan211 merged 2 commits into
apache:mainfrom
mkleen:approx_distinct_runee
Oct 3, 2026
Merged

jayzhan211 merged 2 commits into
apache:mainfrom
mkleen:approx_distinct_runee

Conversation

@mkleen

@mkleen mkleen commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

  • Support the Arrow type RunEndEncoded type for approx_distinct

What changes are included in this PR?

  • Enable HLLAccumulator and HllGroupsAccumulator to support RunEndEncoded
  • Tests for the non-grouped and grouped path as part of aggregate.slt

Are these changes tested?

Yes.

Are there any user-facing changes?

Yes, approx_distinct supports now RunEndEncoded but no breaking changes.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Oct 1, 2026
@mkleen
mkleen marked this pull request as ready for review October 1, 2026 20:22
@mkleen mkleen changed the title feat: Support Struct type in approx_distinct - #23663 feat: Support RunEndEncoded type in approx_distinct Oct 1, 2026
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.59%. Comparing base (141663e) to head (9bfac5f).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #25951      +/-   ##
==========================================
- Coverage   82.59%   82.59%   -0.01%     
==========================================
  Files        1145     1145              
  Lines      443932   443933       +1     
  Branches   443932   443933       +1     
==========================================
- Hits       366663   366656       -7     
- Misses      55012    55017       +5     
- Partials    22257    22260       +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.

@nuno-faria nuno-faria 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.

Thanks @mkleen.

The is_supported_type reminded me that we don't do the same thing for lists, maps, ... So approx_distinct does not work for (e.g.) floats but works for list of floats. I think it's something we should look at in a follow up.

@mkleen

mkleen commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @mkleen.

The is_supported_type reminded me that we don't do the same thing for lists, maps, ... So approx_distinct does not work for (e.g.) floats but works for list of floats. I think it's something we should look at in a follow up.

Thanks for the review @nuno-faria

I agree, the container types such as lists, maps need another iteration. Technically the only unsupported types for approx_distinct are Float16, Float32 and Float64. DuckDB supports them. So maybe it's worth thinking to support them in datafusion as well.

@jayzhan211
jayzhan211 added this pull request to the merge queue Oct 3, 2026
@jayzhan211

Copy link
Copy Markdown
Contributor

Thanks @mkleen @nuno-faria !

Merged via the queue into apache:main with commit a93c9b8 Oct 3, 2026
43 checks passed
Omega359 pushed a commit to Omega359/arrow-datafusion that referenced this pull request Oct 11, 2026
## Which issue does this PR close?

- Closes apache#22989 


## Rationale for this change

- Support the Arrow type `RunEndEncoded` type for `approx_distinct`

## What changes are included in this PR?

- Enable `HLLAccumulator` and `HllGroupsAccumulator` to support
`RunEndEncoded`
- Tests for the non-grouped and grouped path as part of `aggregate.slt` 

## Are these changes tested?

Yes.


## Are there any user-facing changes?

Yes, `approx_distinct` supports now `RunEndEncoded` but no breaking
changes.
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) v56.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support more types for approx_distinct function

4 participants