Skip to content

[SPARK-59154][ML] Optimize decision tree model transform closures - #58454

Draft
zhengruifeng wants to merge 4 commits into
apache:masterfrom
zhengruifeng:ml-spark-59154-tree-classifier-closure-dev-5
Draft

[SPARK-59154][ML] Optimize decision tree model transform closures#58454
zhengruifeng wants to merge 4 commits into
apache:masterfrom
zhengruifeng:ml-spark-59154-tree-classifier-closure-dev-5

Conversation

@zhengruifeng

@zhengruifeng zhengruifeng commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

This PR reduces the transform closure size of DecisionTreeClassificationModel and
DecisionTreeRegressionModel.

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:

build/sbt mllib/compile

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Codex (GPT-5)

@zhengruifeng
zhengruifeng marked this pull request as draft September 1, 2026 15:52
@zhengruifeng
zhengruifeng force-pushed the ml-spark-59154-tree-classifier-closure-dev-5 branch from 452a45d to feb2156 Compare September 2, 2026 06:48
@zhengruifeng zhengruifeng changed the title [SPARK-59154][ML] Optimize tree classification model transform closures [SPARK-59154][ML] Optimize decision tree model transform closures Sep 2, 2026
@zhengruifeng
zhengruifeng force-pushed the ml-spark-59154-tree-classifier-closure-dev-5 branch from feb2156 to 579155f Compare September 2, 2026 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants