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: [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