sandeshkr419 opened a new pull request, #23816:
URL: https://github.com/apache/datafusion/pull/23816
## Which issue does this PR close?
Resolves https://github.com/apache/datafusion/issues/23815
## Rationale for this change
Adds runtime-configurable HLL precision to approx_distinct. Previously the
register count was a compile-time constant (p=14, 16 KiB per sketch); now any
precision between 4 to 18 is supported.
## What changes are included in this PR?
- HyperLogLog::with_precision(p): constructs a sketch at the requested
precision; new() still defaults to p=14.
- HyperLogLog::from_registers(vec): replaces new_with_registers([u8;
16384]); infers p from the slice length.
- ApproxDistinct::with_hll_precision(p): forwards p through every HLL
accumulator path (HLLAccumulator, NumericHLLAccumulator, HllGroupsAccumulator).
Has no effect for types that use exact bitmap counting (Boolean, Int8, UInt8,
Int16, UInt16) — those paths are unaffected regardless of the value passed.
## Are these changes tested?
9 new tests cover: construction at non-default precisions, accuracy within
expected error bounds at p=10 and p=12, roundtrip serialization at p=10/12/14,
cross-precision merge panic (programming error guard), and boundary validation.
## Are there any user-facing changes?
None for existing callers. Old ApproxDistinct::new() and HyperLogLog::new()
continue to use p=14.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]