viirya commented on code in PR #1184:
URL: https://github.com/apache/datafusion-comet/pull/1184#discussion_r1891247701


##########
native/spark-expr/src/variance.rs:
##########
@@ -245,10 +245,8 @@ impl Accumulator for VarianceAccumulator {
 
         Ok(ScalarValue::Float64(match self.count {
             count if count == 0.0 => None,
-            count if count == 1.0 => {
-                if let StatsType::Population = self.stats_type {
-                    Some(0.0)
-                } else if self.null_on_divide_by_zero {
+            count if count == 1.0 && StatsType::Sample == self.stats_type => {
+                if self.null_on_divide_by_zero {

Review Comment:
   I checked Spark `StddevPop` expression. Its evaluation expression is:
   
   ```scala
   override val evaluateExpression: Expression = {
       If(n === 0.0, Literal.create(null, DoubleType), sqrt(m2 / n))
     }
   ```
   
   The special handling is only for Spark `StddevSamp` (i.e., 
`StatsType::Population ` in Comet).
   
   
   ```



-- 
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-unsubscr...@datafusion.apache.org

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


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

Reply via email to