kumarUjjawal commented on code in PR #18937:
URL: https://github.com/apache/datafusion/pull/18937#discussion_r2567113773


##########
datafusion/functions-aggregate/src/variance.rs:
##########
@@ -583,10 +1169,53 @@ impl GroupsAccumulator for VarianceGroupsAccumulator {
 
 #[cfg(test)]
 mod tests {
+    use arrow::array::Decimal128Builder;
     use datafusion_expr::EmitTo;
+    use std::sync::Arc;
 
     use super::*;
 
+    #[test]
+    fn variance_population_accepts_decimal() -> Result<()> {
+        let variance = VariancePopulation::new();
+        variance.return_type(&[DataType::Decimal128(10, 3)])?;
+        Ok(())
+    }
+
+    #[test]
+    fn variance_decimal_input() -> Result<()> {
+        let mut builder = Decimal128Builder::with_capacity(20);
+        for i in 0..10 {
+            builder.append_value(110000 + i);
+        }
+        for i in 0..10 {
+            builder.append_value(-((100000 + i) as i128));
+        }
+        let decimal_array = builder.finish().with_precision_and_scale(10, 
3).unwrap();
+        let array: ArrayRef = Arc::new(decimal_array);
+
+        let mut pop_acc = VarianceAccumulator::try_new(StatsType::Population)?;

Review Comment:
   Yes it should, I made a mistake, there are a few more I will fix it soon.



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