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

   ### What changes were proposed in this pull request?
   
   This PR simplifies `SummarizerBuffer` by precomputing requested metric and 
compute metric flags once, moving one-time array initialization into a helper, 
and splitting merge handling into empty-summary guard clauses plus focused 
non-empty merge/copy helpers.
   
   The change preserves the existing aggregate state layout and public behavior.
   
   ### Why are the changes needed?
   
   `SummarizerBuffer` has several hot paths with repeated `Seq.contains` checks 
and nested null/empty branches. The refactor makes the control flow easier to 
read and removes repeated metric membership checks while keeping the same 
metric computations.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Ran:
   
   ```
   git diff --check
   awk 'length>100 && $0 !~ /^[[:space:]]*(import|package) / && $0 !~ 
/https?:\\/\\// {print FILENAME":"FNR": "length" chars"}' 
mllib/src/main/scala/org/apache/spark/ml/stat/Summarizer.scala\ngrep -rn -P 
"[^\\x00-\\x7F]" 
mllib/src/main/scala/org/apache/spark/ml/stat/Summarizer.scala\n```\n\nDid not 
run the full SBT test suite.\n\n### Was this patch authored or co-authored 
using generative AI tooling?\n\nGenerated-by: OpenAI Codex (GPT-5)\n


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