-
Notifications
You must be signed in to change notification settings - Fork 29k
[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 1 commit
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,10 @@ 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 |
|---|---|---|
|
|
@@ -18,6 +18,7 @@ | |
| package org.apache.spark.ml | ||
|
|
||
| import scala.annotation.varargs | ||
| import scala.reflect.ClassTag | ||
|
|
||
| import org.apache.spark.annotation.Since | ||
| import org.apache.spark.ml.param.{ParamMap, ParamPair} | ||
|
|
@@ -26,7 +27,7 @@ import org.apache.spark.sql.Dataset | |
| /** | ||
| * Abstract class for estimators that fit models to data. | ||
| */ | ||
| abstract class Estimator[M <: Model[M]] extends PipelineStage { | ||
| abstract class Estimator[M <: Model[M] : ClassTag] extends PipelineStage { | ||
|
||
|
|
||
| /** | ||
| * Fits a single model to the input data with optional parameters. | ||
|
|
||
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