zhengruifeng opened a new pull request, #58100:
URL: https://github.com/apache/spark/pull/58100
### What changes were proposed in this pull request?
This PR optimizes `GeneralizedLinearRegressionModel.transform` by
snapshotting the prediction
state before creating transform UDFs. The UDFs now capture only the required
coefficients,
intercept, and `FamilyAndLink` instead of the full model.
The public prediction methods continue to use the same prediction logic
through companion helper
methods.
### Why are the changes needed?
Avoiding the model capture reduces transform-closure retained memory, which
is useful for Spark
Connect server workloads and follows the closure-size optimizations tracked
under SPARK-58584.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
Ran local static checks:
```
git diff --check
grep -rn -P "[^\x00-\x7F]"
mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala
awk 'length>100 && $0 !~ /^[[:space:]]*(import|package) / && $0 !~
/https?:\/\// {print FILENAME":"FNR": "length" chars"}'
mllib/src/main/scala/org/apache/spark/ml/regression/GeneralizedLinearRegression.scala
```
No unit test was added because this is an internal refactor of existing
prediction logic.
### 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]