Jefffrey commented on code in PR #19611:
URL: https://github.com/apache/datafusion/pull/19611#discussion_r2658649237


##########
datafusion/functions-aggregate/src/percentile_cont.rs:
##########
@@ -297,76 +212,71 @@ impl AggregateUDFImpl for PercentileCont {
         ])
     }
 
-    fn accumulator(&self, acc_args: AccumulatorArgs) -> Result<Box<dyn 
Accumulator>> {
-        self.create_accumulator(&acc_args)
+    fn accumulator(&self, args: AccumulatorArgs) -> Result<Box<dyn 
Accumulator>> {
+        let percentile = get_percentile(&args)?;
+
+        let input_dt = args.expr_fields[0].data_type();
+        if input_dt.is_null() {
+            return 
Ok(Box::new(NoopAccumulator::new(ScalarValue::Float64(None))));
+        }

Review Comment:
   I think it makes more sense to validate the percentile regardless of if 
datatype is null or not, otherwise could lead to permitting `select 
percentile_cont(null, 2.0)`



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