You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "uros-b (via GitHub)" <gi...@apache.org> on 2026/09/02 09:47:13 UTC
[PR] [SPARK-59173][ML] Use isEmpty instead of size == 0 in MLlib [spark]
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: 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-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #58471:
URL: https://github.com/apache/spark/pull/58471#issuecomment-5525166496
Thank you @dongjoon-hyun and @HyukjinKwon! We should merge this into 4.x as well, please see: https://github.com/apache/spark/pull/57519#issuecomment-5264575718.
--
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-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun commented on PR #58471:
URL: https://github.com/apache/spark/pull/58471#issuecomment-5520820414
**Merge Summary:**
- merged into master https://github.com/apache/spark/commit/08757655cc2a6f613db306dc2480920f2f5b1bb1
*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
Re: [PR] [SPARK-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #58471:
URL: https://github.com/apache/spark/pull/58471#issuecomment-5525202664
**Merge Summary:**
- merged into branch-4.x https://github.com/apache/spark/commit/490044689a78db6ad83cf195dcafc35421bf819f
*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
Re: [PR] [SPARK-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #58471:
URL: https://github.com/apache/spark/pull/58471#issuecomment-5509557802
added @HyukjinKwon for ML
--
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-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib [spark]
Posted by "uros-b (via GitHub)" <gi...@apache.org>.
uros-b commented on PR #58471:
URL: https://github.com/apache/spark/pull/58471#issuecomment-5509551100
cc @dongjoon-hyun @HyukjinKwon here, regarding https://github.com/apache/spark/pull/58449.
--
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-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib [spark]
Posted by "dongjoon-hyun (via GitHub)" <gi...@apache.org>.
dongjoon-hyun closed pull request #58471: [SPARK-59173][ML] Use isEmpty/nonEmpty instead of size comparisons in MLlib
URL: https://github.com/apache/spark/pull/58471
--
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