sandeshkr419 commented on code in PR #23816:
URL: https://github.com/apache/datafusion/pull/23816#discussion_r3677571483
##########
datafusion/functions-aggregate/src/approx_distinct.rs:
##########
@@ -654,12 +701,29 @@ impl Default for ApproxDistinct {
#[derive(PartialEq, Eq, Hash)]
pub struct ApproxDistinct {
signature: Signature,
+ /// HLL register precision. Only used for types that take the HLL code path
+ /// (i.e. not Boolean / small-int types, which use exact bitmap counting).
+ hll_precision: usize,
}
impl ApproxDistinct {
pub fn new() -> Self {
+ Self::with_hll_precision(DEFAULT_HLL_P)
+ }
+
+ /// Creates an `ApproxDistinct` that uses HLL sketches with `2^p`
registers.
+ ///
+ /// This only has effect for types that use the HLL accumulator path. Small
+ /// integer and boolean types use exact bitmap counting regardless of this
+ /// value. Valid range: `HLL_P_MIN..=HLL_P_MAX` (4..=18).
+ pub fn with_hll_precision(p: usize) -> Self {
Review Comment:
Good call, replaced the `assert!` with `plan_err!` so invalid precision
surfaces as a clean DataFusion error rather than a panic.
--
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]