uros-b opened a new pull request, #58471:
URL: https://github.com/apache/spark/pull/58471

   ### What changes were proposed in this pull request?
   
   This replaces the `collection.size == 0` emptiness idiom with the more 
direct `collection.isEmpty` in the `mllib` module (3 occurrences):
   - `TreeEnsembleModel` (`ml/tree/treeModels.scala`, main) -- 
`totalImportances` is an `OpenHashMap`, which `extends Iterable`.
   - `ALSSuite` (test) -- two filtered `Seq[ShuffleDependency]` checks.
   
   `ChiSqTest` is deliberately left unchanged: there `expected.size` / 
`observed.size` are the dimensions of an `mllib.linalg.Vector` (used with a 
numeric `== 0.0` comparison), not a collection size, and `Vector` has no 
`isEmpty`.
   
   This is the `mllib` counterpart of SPARK-59149 (SQL modules) and SPARK-59172 
(core).
   
   ### Why are the changes needed?
   
   `isEmpty` states the intent directly. Behavior is unchanged: every converted 
receiver (`OpenHashMap`, `Seq`) defines `isEmpty` as exactly `size == 0`.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No.
   
   ### How was this patch tested?
   
   Existing tests. This is a behavior-preserving refactor; the `mllib` module 
compiles cleanly.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Code (Opus 4.8)
   


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