alamb commented on code in PR #7211:
URL: https://github.com/apache/arrow-datafusion/pull/7211#discussion_r1287034286
##########
datafusion/physical-expr/src/aggregate/regr.rs:
##########
@@ -316,12 +415,42 @@ impl Accumulator for RegrSlopeAccumulator {
fn evaluate(&self) -> Result<ScalarValue> {
let cov_pop_x_y = self.algo_const / self.count as f64;
let var_pop_x = self.m2_x / self.count as f64;
+ let var_pop_y = self.m2_y / self.count as f64;
+
+ let nullif_or_stat = |cond: bool, stat: f64| {
+ if cond {
+ Ok(ScalarValue::Float64(None))
+ } else {
+ Ok(ScalarValue::Float64(Some(stat)))
+ }
+ };
- // Only 0/1 point or slope is infinite
- if self.count <= 1 || var_pop_x == 0.0 {
- Ok(ScalarValue::Float64(None))
- } else {
- Ok(ScalarValue::Float64(Some(cov_pop_x_y / var_pop_x)))
+ match self.regr_type {
Review Comment:
Nice
--
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]