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

   ### What changes were proposed in this pull request?
   
   This PR specializes the column-expression prediction hooks for
   `DecisionTreeClassificationModel`, `RandomForestClassificationModel`, and
   `GBTClassificationModel`.
   
   The new implementations snapshot only the tree roots, tree weights, class 
count, loss, and
   thresholds needed by each requested output column. Shared companion-object 
helpers perform raw
   prediction and probability conversion without retaining the full model in 
UDF closures.
   
   ### Why are the changes needed?
   
   The default probabilistic classifier column hooks invoke bound model 
methods. Their UDF closures
   therefore retain the complete model and parameter graph in query plans, even 
though tree scoring
   needs only the tree nodes and a small amount of immutable prediction state. 
This adds avoidable
   driver memory pressure for long-lived Spark Connect servers.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   The following checks passed:
   
   ```
   build/sbt mllib/compile
   build/sbt mllib/scalastyle
   ```
   
   No new tests were added because the existing 
`ProbabilisticClassifierSuite.testPredictMethods`
   coverage exercises all combinations of raw-prediction, probability, and 
prediction columns for
   all three tree classifiers.
   
   ### 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