2010YOUY01 commented on code in PR #23816:
URL: https://github.com/apache/datafusion/pull/23816#discussion_r3725664891


##########
datafusion/functions-aggregate/src/approx_distinct.rs:
##########
@@ -654,14 +707,35 @@ 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 {
             signature: Signature::any(1, Volatility::Immutable),
+            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) -> Result<Self> {

Review Comment:
   Non-blocking suggestion:
   
   It's the only API to use this configuration now, however mostly users are 
using higher level SQL/Dataframe API.
   
   So it would be better to be able to set it from global configurations. After 
that we can add some end-to-end tests.
   
   I remember there are no existing configurations targeting individual 
functions, so perhaps some refactor would be needed.



-- 
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]

Reply via email to