zhengruifeng opened a new pull request, #57755:
URL: https://github.com/apache/spark/pull/57755

   ### What changes were proposed in this pull request?
   
   This draft rewrites `CountVectorizer.fit` to use DataFrame operations 
instead of converting the input to an RDD. It calculates term frequency with 
`explode` and aggregation, and calculates document frequency with 
`explode(array_distinct(...))` only when DF filtering is requested. It also 
uses a native ordered limit for vocabulary selection.
   
   ### Why are the changes needed?
   
   The current implementation leaves the DataFrame execution path for manual 
per-document maps and `reduceByKey`. Keeping the computation in DataFrame 
operations lets Spark plan the aggregations natively and avoids 
document-frequency work when neither DF parameter is set.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Added regression coverage that distinguishes document frequency from 
repeated term frequency. `build/sbt mllib/Test/compile` completed successfully. 
The test suite was not run. Static checks: `git diff --check`, ASCII scan, and 
changed-line length scan.
   
   ### 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