You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "theirix (via GitHub)" <gi...@apache.org> on 2026/04/16 22:18:53 UTC

Re: [PR] feat: refactor percentiles to TypeSignature, coerce to floats [datafusion]

theirix commented on code in PR #21074:
URL: https://github.com/apache/datafusion/pull/21074#discussion_r3096693415


##########
datafusion/functions-aggregate/src/approx_percentile_cont.rs:
##########
@@ -132,22 +132,45 @@ impl Default for ApproxPercentileCont {
 impl ApproxPercentileCont {
     /// Create a new [`ApproxPercentileCont`] aggregate function.
     pub fn new() -> Self {
-        let mut variants = Vec::with_capacity(NUMERICS.len() * (INTEGERS.len() + 1));
         // Accept any numeric value paired with a float64 percentile
-        for num in NUMERICS {
-            variants.push(TypeSignature::Exact(vec![num.clone(), DataType::Float64]));
-            // Additionally accept an integer number of centroids for T-Digest
-            for int in INTEGERS {
-                variants.push(TypeSignature::Exact(vec![
-                    num.clone(),
-                    DataType::Float64,
-                    int.clone(),
-                ]))
-            }
-        }
-        Self {
-            signature: Signature::one_of(variants, Volatility::Immutable),
-        }
+        // Additionally accept an integer number of centroids for T-Digest
+        let signature = Signature::one_of(

Review Comment:
   Agree, removed some code. It also affected `approx_median`, piggybacking on `approx_percentile_cont` - updated signature and tests as well. 
   
   Clarified the scope of this PR in description - it changes more than expected



-- 
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: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org