Skip to content

feat: Support float 32 and float 64 in approx_distinct#23084

Draft
mkleen wants to merge 2 commits into
apache:mainfrom
mkleen:float_approx_distinct
Draft

feat: Support float 32 and float 64 in approx_distinct#23084
mkleen wants to merge 2 commits into
apache:mainfrom
mkleen:float_approx_distinct

Conversation

@mkleen

@mkleen mkleen commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

  • Float32 and Float64 don't implement Hash on their native type so they they can't use NumericHLLAccumulator, therefore they were not supported by approx_distinct.
  • Float32 and Float64 can be hashed generically via create_hashesin HLLAccumulator and HllGroupsAccumulator , exactly like the string/binary types.
  • f32::NaN and f:64::NaN are hashed by their bit pattern, so repeated NaN values sharing the same bits collapse to a single distinct value.

What changes are included in this PR?

See above.

Are these changes tested?

Yes, for the and non-grouped and grouped part as part of approx_distinct.rst and aggregate.slt

Are there any user-facing changes?

Yes, but no breaking changes.

@github-actions github-actions Bot added sqllogictest SQL Logic Tests (.slt) functions Changes to functions implementation labels Jun 22, 2026
@mkleen mkleen changed the title Support float32 and float64 in approx_distinct feat: Support float32 and float64 in approx_distinct Jun 22, 2026
Float32 and Float64 don't implement `Hash` on their native type.
Therefore, they can't use `NumericHLLAccumulator`. However they
can be hashed generically via `create_hashes`, exactly like the
string/binary types.
@mkleen mkleen force-pushed the float_approx_distinct branch from 2e71c6c to 58dbfa1 Compare June 22, 2026 14:09
@mkleen mkleen changed the title feat: Support float32 and float64 in approx_distinct feat: Support float 32 and float 64 in approx_distinct Jun 22, 2026
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.

1 participant