Skip to content

Commit a9f13e1

Browse files
LuciferYangdongjoon-hyun
authored andcommitted
[SPARK-43849][BUILD] Enable unused imports check for Scala 2.13
### What changes were proposed in this pull request? This pr aims to enable `unused imports` check for Scala 2.13. There is an exception here for `import scala.language.higherKinds`(Scala 2.13 does not need to import them , while Scala 2.12 must import them), so this pr add two new suppression rules for it. ### Why are the changes needed? Enable `unused imports` check for Scala 2.13. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Pass Github Actions Closes #41356 from LuciferYang/SPARK-43849. Authored-by: yangjie01 <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
1 parent 383d9fb commit a9f13e1

File tree

4 files changed

+14
-9
lines changed

4 files changed

+14
-9
lines changed

connector/connect/server/src/main/scala/org/apache/spark/sql/connect/planner/SparkConnectPlanner.scala

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,9 @@ import org.apache.spark.connect.proto
3131
import org.apache.spark.connect.proto.{ExecutePlanResponse, SqlCommand, StreamingQueryCommand, StreamingQueryCommandResult, StreamingQueryInstanceId, WriteStreamOperationStart, WriteStreamOperationStartResult}
3232
import org.apache.spark.connect.proto.ExecutePlanResponse.SqlCommandResult
3333
import org.apache.spark.connect.proto.Parse.ParseFormat
34-
import org.apache.spark.connect.proto.StreamingQueryCommand
35-
import org.apache.spark.connect.proto.StreamingQueryCommandResult
36-
import org.apache.spark.connect.proto.StreamingQueryInstanceId
3734
import org.apache.spark.connect.proto.StreamingQueryManagerCommand
3835
import org.apache.spark.connect.proto.StreamingQueryManagerCommandResult
3936
import org.apache.spark.connect.proto.StreamingQueryManagerCommandResult.StreamingQueryInstance
40-
import org.apache.spark.connect.proto.WriteStreamOperationStart
4137
import org.apache.spark.connect.proto.WriteStreamOperationStart.TriggerCase
4238
import org.apache.spark.ml.{functions => MLFunctions}
4339
import org.apache.spark.sql.{Column, Dataset, Encoders, ForeachWriter, RelationalGroupedDataset, SparkSession}

pom.xml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2855,9 +2855,9 @@
28552855
<arg>-explaintypes</arg>
28562856
<arg>-target:jvm-1.8</arg>
28572857
<arg>-Wconf:cat=deprecation:wv,any:e</arg>
2858+
<arg>-Wunused:imports</arg>
28582859
<!--
28592860
TODO(SPARK-33805): Undo the corresponding deprecated usage suppression rule after fixed
2860-
<arg>-Wunused:imports</arg>
28612861
-->
28622862
<arg>-Wconf:cat=scaladoc:wv</arg>
28632863
<arg>-Wconf:cat=lint-multiarg-infix:wv</arg>
@@ -2891,6 +2891,12 @@
28912891
<arg>-Wconf:cat=unchecked&amp;msg=outer reference:s</arg>
28922892
<arg>-Wconf:cat=unchecked&amp;msg=eliminated by erasure:s</arg>
28932893
<arg>-Wconf:msg=^(?=.*?a value of type)(?=.*?cannot also be).+$:s</arg>
2894+
<!--
2895+
TODO(SPARK-43850): Remove the following suppression rules and remove `import scala.language.higherKinds`
2896+
from the corresponding files when Scala 2.12 is no longer supported.
2897+
-->
2898+
<arg>-Wconf:cat=unused-imports&amp;src=org\/apache\/spark\/graphx\/impl\/VertexPartitionBase.scala:s</arg>
2899+
<arg>-Wconf:cat=unused-imports&amp;src=org\/apache\/spark\/graphx\/impl\/VertexPartitionBaseOps.scala:s</arg>
28942900
</args>
28952901
<jvmArgs>
28962902
<jvmArg>-Xss128m</jvmArg>

project/SparkBuild.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,8 +256,7 @@ object SparkBuild extends PomBuild {
256256
// see `scalac -Wconf:help` for details
257257
"-Wconf:cat=deprecation:wv,any:e",
258258
// 2.13-specific warning hits to be muted (as narrowly as possible) and addressed separately
259-
// TODO(SPARK-33499): Enable this option when Scala 2.12 is no longer supported.
260-
// "-Wunused:imports",
259+
"-Wunused:imports",
261260
"-Wconf:cat=lint-multiarg-infix:wv",
262261
"-Wconf:cat=other-nullary-override:wv",
263262
"-Wconf:cat=other-match-analysis&site=org.apache.spark.sql.catalyst.catalog.SessionCatalog.lookupFunction.catalogFunction:wv",
@@ -283,7 +282,11 @@ object SparkBuild extends PomBuild {
283282
// 4. `fruitless type test: a value of TypeA cannot also be a TypeB`
284283
"-Wconf:cat=unchecked&msg=outer reference:s",
285284
"-Wconf:cat=unchecked&msg=eliminated by erasure:s",
286-
"-Wconf:msg=^(?=.*?a value of type)(?=.*?cannot also be).+$:s"
285+
"-Wconf:msg=^(?=.*?a value of type)(?=.*?cannot also be).+$:s",
286+
// TODO(SPARK-43850): Remove the following suppression rules and remove `import scala.language.higherKinds`
287+
// from the corresponding files when Scala 2.12 is no longer supported.
288+
"-Wconf:cat=unused-imports&src=org\\/apache\\/spark\\/graphx\\/impl\\/VertexPartitionBase.scala:s",
289+
"-Wconf:cat=unused-imports&src=org\\/apache\\/spark\\/graphx\\/impl\\/VertexPartitionBaseOps.scala:s"
287290
)
288291
}
289292
}

sql/catalyst/src/main/scala-2.13/org/apache/spark/sql/catalyst/expressions/ExpressionSet.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
package org.apache.spark.sql.catalyst.expressions
1919

20-
import scala.collection.{mutable, IterableFactory, IterableOps}
20+
import scala.collection.mutable
2121
import scala.collection.mutable.ArrayBuffer
2222

2323
object ExpressionSet {

0 commit comments

Comments
 (0)