[SPARK-59154][ML] Optimize decision tree model transform closures - #58454
Draft
zhengruifeng wants to merge 4 commits into
Draft
[SPARK-59154][ML] Optimize decision tree model transform closures#58454zhengruifeng wants to merge 4 commits into
zhengruifeng wants to merge 4 commits into
Conversation
zhengruifeng
marked this pull request as draft
September 1, 2026 15:52
zhengruifeng
force-pushed
the
ml-spark-59154-tree-classifier-closure-dev-5
branch
from
September 2, 2026 06:48
452a45d to
feb2156
Compare
zhengruifeng
force-pushed
the
ml-spark-59154-tree-classifier-closure-dev-5
branch
from
September 2, 2026 10:03
feb2156 to
579155f
Compare
HyukjinKwon
approved these changes
Sep 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
This PR reduces the transform closure size of
DecisionTreeClassificationModelandDecisionTreeRegressionModel.The classification model snapshots the root node and uses companion-object helpers for raw
prediction and probability conversion. The regression model snapshots the root node for
prediction, variance, and leaf output. A shared decision-tree helper computes leaf predictions
without retaining either model in the UDF closure.
Why are the changes needed?
The existing transform UDFs invoke bound model methods. Their closures therefore retain the
complete model and parameter graph even though decision-tree scoring only needs the root node.
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 check passed:
Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)