Github user BenFradet commented on a diff in the pull request:
https://github.com/apache/spark/pull/10381#discussion_r48039929
--- Diff: mllib/src/main/scala/org/apache/spark/ml/param/params.scala ---
@@ -859,8 +859,15 @@ final class ParamMap private[ml] (private val map:
mutable.Map[Param[Any], Any])
* Filters this param map for the given parent.
*/
def filter(parent: Params): ParamMap = {
- val filtered = map.filterKeys(_.parent == parent)
- new ParamMap(filtered.asInstanceOf[mutable.Map[Param[Any], Any]])
+ // Don't use filterKeys because mutable.Map#filterKeys
+ // returns the instance of collections.Map, not mutable.Map.
+ // Otherwise, we get ClassCastException.
+ // Not using filterKeys also avoid SI-6654
+ val filtered = map.filter {
+ case (k, _) =>
+ k.parent == parent.uid
--- End diff --
the indent seems to be broken
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]