-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-26090][CORE][SQL][ML] Resolve most miscellaneous deprecation and build warnings for Spark 3 #23065
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-26090][CORE][SQL][ML] Resolve most miscellaneous deprecation and build warnings for Spark 3 #23065
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 |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ import org.apache.spark.storage.RDDInfo | |
| @DeveloperApi | ||
| class StageInfo( | ||
| val stageId: Int, | ||
| @deprecated("Use attemptNumber instead", "2.3.0") val attemptId: Int, | ||
| private val attemptId: Int, | ||
|
||
| val name: String, | ||
| val numTasks: Int, | ||
| val rddInfos: Seq[RDDInfo], | ||
|
|
@@ -56,6 +56,8 @@ class StageInfo( | |
| completionTime = Some(System.currentTimeMillis) | ||
| } | ||
|
|
||
| // This would just be the second constructor arg, except we need to maintain this method | ||
| // with parentheses for compatibility | ||
| def attemptNumber(): Int = attemptId | ||
|
|
||
| private[spark] def getStatusString: String = { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -138,7 +138,7 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| test("test NULL avro type") { | ||
| withTempPath { dir => | ||
| val fields = | ||
| Seq(new Field("null", Schema.create(Type.NULL), "doc", null)).asJava | ||
| Seq(new Field("null", Schema.create(Type.NULL), "doc", null.asInstanceOf[AnyVal])).asJava | ||
|
||
| val schema = Schema.createRecord("name", "docs", "namespace", false) | ||
| schema.setFields(fields) | ||
| val datumWriter = new GenericDatumWriter[GenericRecord](schema) | ||
|
|
@@ -161,7 +161,7 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| val avroSchema: Schema = { | ||
| val union = | ||
| Schema.createUnion(List(Schema.create(Type.INT), Schema.create(Type.LONG)).asJava) | ||
| val fields = Seq(new Field("field1", union, "doc", null)).asJava | ||
| val fields = Seq(new Field("field1", union, "doc", null.asInstanceOf[AnyVal])).asJava | ||
| val schema = Schema.createRecord("name", "docs", "namespace", false) | ||
| schema.setFields(fields) | ||
| schema | ||
|
|
@@ -189,7 +189,7 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| val avroSchema: Schema = { | ||
| val union = | ||
| Schema.createUnion(List(Schema.create(Type.FLOAT), Schema.create(Type.DOUBLE)).asJava) | ||
| val fields = Seq(new Field("field1", union, "doc", null)).asJava | ||
| val fields = Seq(new Field("field1", union, "doc", null.asInstanceOf[AnyVal])).asJava | ||
| val schema = Schema.createRecord("name", "docs", "namespace", false) | ||
| schema.setFields(fields) | ||
| schema | ||
|
|
@@ -221,7 +221,7 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| Schema.create(Type.NULL) | ||
| ).asJava | ||
| ) | ||
| val fields = Seq(new Field("field1", union, "doc", null)).asJava | ||
| val fields = Seq(new Field("field1", union, "doc", null.asInstanceOf[AnyVal])).asJava | ||
| val schema = Schema.createRecord("name", "docs", "namespace", false) | ||
| schema.setFields(fields) | ||
| schema | ||
|
|
@@ -247,7 +247,7 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| test("Union of a single type") { | ||
| withTempPath { dir => | ||
| val UnionOfOne = Schema.createUnion(List(Schema.create(Type.INT)).asJava) | ||
| val fields = Seq(new Field("field1", UnionOfOne, "doc", null)).asJava | ||
| val fields = Seq(new Field("field1", UnionOfOne, "doc", null.asInstanceOf[AnyVal])).asJava | ||
| val schema = Schema.createRecord("name", "docs", "namespace", false) | ||
| schema.setFields(fields) | ||
|
|
||
|
|
@@ -274,10 +274,10 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| val complexUnionType = Schema.createUnion( | ||
| List(Schema.create(Type.INT), Schema.create(Type.STRING), fixedSchema, enumSchema).asJava) | ||
| val fields = Seq( | ||
| new Field("field1", complexUnionType, "doc", null), | ||
| new Field("field2", complexUnionType, "doc", null), | ||
| new Field("field3", complexUnionType, "doc", null), | ||
| new Field("field4", complexUnionType, "doc", null) | ||
| new Field("field1", complexUnionType, "doc", null.asInstanceOf[AnyVal]), | ||
| new Field("field2", complexUnionType, "doc", null.asInstanceOf[AnyVal]), | ||
| new Field("field3", complexUnionType, "doc", null.asInstanceOf[AnyVal]), | ||
| new Field("field4", complexUnionType, "doc", null.asInstanceOf[AnyVal]) | ||
| ).asJava | ||
| val schema = Schema.createRecord("name", "docs", "namespace", false) | ||
| schema.setFields(fields) | ||
|
|
@@ -941,7 +941,7 @@ class AvroSuite extends QueryTest with SharedSQLContext with SQLTestUtils { | |
| val avroArrayType = resolveNullable(Schema.createArray(avroType), nullable) | ||
| val avroMapType = resolveNullable(Schema.createMap(avroType), nullable) | ||
| val name = "foo" | ||
| val avroField = new Field(name, avroType, "", null) | ||
| val avroField = new Field(name, avroType, "", null.asInstanceOf[AnyVal]) | ||
| val recordSchema = Schema.createRecord("name", "doc", "space", true, Seq(avroField).asJava) | ||
| val avroRecordType = resolveNullable(recordSchema, nullable) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -56,7 +56,7 @@ trait KafkaContinuousTest extends KafkaSourceTest { | |
| } | ||
|
|
||
| // Continuous processing tasks end asynchronously, so test that they actually end. | ||
| private val tasksEndedListener = new SparkListener() { | ||
| private class TasksEndedListener extends SparkListener { | ||
|
||
| val activeTaskIdCount = new AtomicInteger(0) | ||
|
|
||
| override def onTaskStart(start: SparkListenerTaskStart): Unit = { | ||
|
|
@@ -68,6 +68,8 @@ trait KafkaContinuousTest extends KafkaSourceTest { | |
| } | ||
| } | ||
|
|
||
| private val tasksEndedListener = new TasksEndedListener() | ||
|
|
||
| override def beforeEach(): Unit = { | ||
| super.beforeEach() | ||
| spark.sparkContext.addSparkListener(tasksEndedListener) | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,8 +17,6 @@ | |
|
|
||
| package org.apache.spark.ml.feature | ||
|
|
||
| import scala.beans.BeanInfo | ||
|
|
||
| import org.apache.spark.annotation.Since | ||
| import org.apache.spark.ml.linalg.Vector | ||
|
|
||
|
|
@@ -30,8 +28,12 @@ import org.apache.spark.ml.linalg.Vector | |
| * @param features List of features for this data point. | ||
| */ | ||
| @Since("2.0.0") | ||
| @BeanInfo | ||
| case class LabeledPoint(@Since("2.0.0") label: Double, @Since("2.0.0") features: Vector) { | ||
|
|
||
| def getLabel: Double = label | ||
|
||
|
|
||
| def getFeatures: Vector = features | ||
|
|
||
| override def toString: String = { | ||
| s"($label,$features)" | ||
| } | ||
|
|
||
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.
LevenshteinDistance moved here from commons lang