You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2026/08/19 03:09:16 UTC
[PR] [SPARK-58853][ML] Optimize IDFModel transform closure [spark]
zhengruifeng opened a new pull request, #58099:
URL: https://github.com/apache/spark/pull/58099
### What changes were proposed in this pull request?
This PR optimizes `IDFModel.transform` by snapshotting the underlying IDF vector before creating
the transform UDF. The UDF delegates to a companion helper and no longer captures the full
`IDFModel` wrapper.
### 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/feature/IDF.scala
awk 'length>100 && $0 !~ /^[[:space:]]*(import|package) / && $0 !~ /https?:\/\// {print FILENAME":"FNR": "length" chars"}' mllib/src/main/scala/org/apache/spark/ml/feature/IDF.scala
```
No unit test was added because this is an internal refactor of existing IDF vector transformation
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-58853][ML] Optimize IDFModel transform closure [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #58099: [SPARK-58853][ML] Optimize IDFModel transform closure
URL: https://github.com/apache/spark/pull/58099
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
Re: [PR] [SPARK-58853][ML] Optimize IDFModel transform closure [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #58099:
URL: https://github.com/apache/spark/pull/58099#issuecomment-5340970838
**Merge Summary:**
- merged into master https://github.com/apache/spark/commit/9b290e006e3b3e67f4f1edef1c2a899a336d5cbc
- merged into branch-4.x https://github.com/apache/spark/commit/ab63aa08b66c0f37b0082a2a38b4932b8ad8b8a0
*Posted by `merge_spark_pr.py`*
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org