zhengruifeng opened a new pull request, #57389: URL: https://github.com/apache/spark/pull/57389
### What changes were proposed in this pull request? Replace the transient `Map[LeafNode, Int]` used by tree leaf prediction with a transient integer cache on each `LeafNode`. The cache assigns the same left-to-right DFS indices once per tree, so prediction still traverses the tree normally and returns the existing leaf ID. ### Why are the changes needed? Large trees can have many leaves. When leaf prediction is used, the map creates a hash-table entry and boxed value for every leaf in each model copy. A single transient integer per leaf keeps the lookup constant-time while substantially reducing that cache's memory overhead. ### Does this PR introduce _any_ user-facing change? No. Leaf IDs and their traversal order are unchanged. ### How was this patch tested? Not run yet. The existing decision-tree and ensemble leaf-prediction suites will be run before this draft is marked ready for review. ### 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]
