kazuyukitanimura commented on code in PR #6830:
URL: https://github.com/apache/datafusion-comet/pull/6830#discussion_r4251136482


##########
native/spark-expr/src/agg_funcs/correlation.rs:
##########
@@ -55,10 +87,41 @@ impl Correlation {
                 Volatility::Immutable,
             ),
             null_on_divide_by_zero,
+            zero_divisor: ZeroDivisor {
+                eval_mode,
+                expr_id,
+                registry,
+            },
         }
     }
 }
 
+/// How the `Divide` in Spark's `ck / sqrt(xMk * yMk)` treats a zero 
denominator.
+/// It returns null in LEGACY mode and raises DIVIDE_BY_ZERO, carrying the 
`corr`
+/// call's query context, in ANSI mode.
+#[derive(Debug, Clone)]
+pub(crate) struct ZeroDivisor {

Review Comment:
   Done in 48320ddee. ZeroDivisor now lives in welford.rs and regr_r2 goes 
through it, so the planner passes expr_id and the registry to Regr::new too. 
The statistical aggregates regr_r2 underflow respects ANSI mode test now does 
the same fragment comparison as the corr test, through a shared 
checkQueryContextMatchesSpark helper. 



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