zhengruifeng opened a new pull request, #58111:
URL: https://github.com/apache/spark/pull/58111

   ### What changes were proposed in this pull request?
   
   This PR updates `MultivariateOnlineSummarizer` and `SummarizerBuffer` to 
propagate `NaN`
   values for `min` and `max` when a feature contains `NaN`.
   
   The add path now uses `math.min` and `math.max`, matching the merge path 
behavior and
   allowing `NaN` to be preserved in the running min/max arrays.
   
   ### Why are the changes needed?
   
   Previously, `min` and `max` were updated through direct `<` and `>` 
comparisons. Since
   comparisons with `NaN` are false, `NaN` values could be ignored and finite 
values could be
   returned even when a column contained `NaN`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. `Statistics.colStats`, `MultivariateOnlineSummarizer`, and `Summarizer` 
now return
   `NaN` for `min` and `max` in a feature dimension if that dimension contains 
`NaN`.
   
   ### How was this patch tested?
   
   Added regression tests for both `MultivariateOnlineSummarizer` and 
`Summarizer`.
   
   Ran:
   
   ```
   build/sbt "mllib/testOnly 
org.apache.spark.mllib.stat.MultivariateOnlineSummarizerSuite 
org.apache.spark.ml.stat.SummarizerSuite"
   ```
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Codex (GPT-5)
   


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