-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-29292][SQL][ML] Update rest of default modules (Hive, ML, etc) for Scala 2.13 compilation #29111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[SPARK-29292][SQL][ML] Update rest of default modules (Hive, ML, etc) for Scala 2.13 compilation #29111
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,7 +82,7 @@ object SparkKMeans { | |
| while(tempDist > convergeDist) { | ||
| val closest = data.map (p => (closestPoint(p, kPoints), (p, 1))) | ||
|
|
||
| val pointStats = closest.reduceByKey{case ((p1, c1), (p2, c2)) => (p1 + p2, c1 + c2)} | ||
| val pointStats = closest.reduceByKey(mergeResults) | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not quite sure why, but a few calls to |
||
|
|
||
| val newPoints = pointStats.map {pair => | ||
| (pair._1, pair._2._1 * (1.0 / pair._2._2))}.collectAsMap() | ||
|
|
@@ -102,5 +102,11 @@ object SparkKMeans { | |
| kPoints.foreach(println) | ||
| spark.stop() | ||
| } | ||
|
|
||
| private def mergeResults( | ||
| a: (Vector[Double], Int), | ||
| b: (Vector[Double], Int)): (Vector[Double], Int) = { | ||
| (a._1 + b._1, a._2 + b._2) | ||
| } | ||
| } | ||
| // scalastyle:on println | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,7 +76,7 @@ abstract class Estimator[M <: Model[M]] extends PipelineStage { | |
| * @return fitted models, matching the input parameter maps | ||
| */ | ||
| @Since("2.0.0") | ||
| def fit(dataset: Dataset[_], paramMaps: Array[ParamMap]): Seq[M] = { | ||
| def fit(dataset: Dataset[_], paramMaps: Seq[ParamMap]): Seq[M] = { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cc @mengxr and @gatorsmile
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this fixes the weird compile error (Arrays + generic types are stricter in Scala 2.13) though I don't directly see what it has to do with type M. Still, this is an API change I think MiMa will fail and I think I need another workaround for that. This is an obscure method that isn't even called by tests, AFAICT, so not sure it even has coverage. |
||
| paramMaps.map(fit(dataset, _)) | ||
| } | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WrappedArray is gone in 2.13; this should be an equivalent superclass