-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22087][SPARK-14650][WIP][BUILD][REPL][CORE] Compile Spark REPL for Scala 2.12 + other 2.12 fixes #19307
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
Conversation
| @@ -2826,33 +2826,33 @@ object WritableConverter { | |||
| // them automatically. However, we still keep the old functions in SparkContext for backward | |||
| // compatibility and forward to the following functions directly. | |||
|
|
|||
| implicit def intWritableConverter(): WritableConverter[Int] = | |||
| simpleWritableConverter[Int, IntWritable](_.get) | |||
| implicit val intWritableConverter: () => WritableConverter[Int] = | |||
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.
These changes were necessary to make the implicits work in 2.12 now that eta-expansion of zero-arg methods is deprecated and apparently doesn't work for implicit resolution. It passes MiMa, but we could be conservative and retain the existing methods, and add function vals instead.
|
|
||
| implicit def writableWritableConverter[T <: Writable](): WritableConverter[T] = | ||
| new WritableConverter[T](_.runtimeClass.asInstanceOf[Class[T]], _.asInstanceOf[T]) | ||
| implicit def writableWritableConverter[T <: Writable : ClassTag]: () => WritableConverter[T] = |
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.
ClassTag was required here, for reasons I don't fully get
| @@ -218,11 +218,13 @@ private[history] class FsHistoryProvider(conf: SparkConf, clock: Clock) | |||
| if (!conf.contains("spark.testing")) { | |||
| // A task that periodically checks for event log updates on disk. | |||
| logDebug(s"Scheduling update thread every $UPDATE_INTERVAL_S seconds") | |||
| pool.scheduleWithFixedDelay(getRunner(checkForLogs), 0, UPDATE_INTERVAL_S, TimeUnit.SECONDS) | |||
| pool.scheduleWithFixedDelay( | |||
| getRunner(() => checkForLogs()), 0, UPDATE_INTERVAL_S, TimeUnit.SECONDS) | |||
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.
These changes avoid warnings about eta-expansion of zero-arg methods. It works fine in 2.11 as well; just not relying on syntactic sugar for the same.
| case e: Throwable => | ||
| logError("App dir cleanup failed: " + e.getMessage, e) | ||
| }(cleanupThreadExecutor) | ||
| cleanupFuture.failed.foreach(e => |
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.
onFailure, onSuccess are deprecated in 2.12. This should be equivalent in 2.11+2.12
| @@ -396,12 +396,12 @@ class DAGScheduler( | |||
|
|
|||
| /** Find ancestor shuffle dependencies that are not registered in shuffleToMapStage yet */ | |||
| private def getMissingAncestorShuffleDependencies( | |||
| rdd: RDD[_]): Stack[ShuffleDependency[_, _, _]] = { | |||
| val ancestors = new Stack[ShuffleDependency[_, _, _]] | |||
| rdd: RDD[_]): ArrayStack[ShuffleDependency[_, _, _]] = { | |||
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.
Stack is deprecated in 2.12 for poor performance; ArrayStack should work the same and be faster, in 2.11 too
external/kafka-0-10-sql/pom.xml
Outdated
| <profile> | ||
| <id>scala-2.12</id> | ||
| <properties> | ||
| <kafka.version>0.10.1.1</kafka.version> |
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.
Only 0.10.1+ supports Scala 2.12. By the time a 2.12 build is actually supported we may be on to 0.10.2. Not sure. This at least makes it work
| * sees any files, so that the Spark context is visible in those files. This is a bit of a | ||
| * hack, but there isn't another hook available to us at this point. | ||
| */ | ||
| override def createInterpreter(): Unit = { |
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.
This is the only meaningful difference from the 2.11 REPL, as it has to hook into a different place. All other REPL-related code isn't specific to 2.11/2.12 and was moved out into the common src directory in the repl module
| @@ -230,19 +230,16 @@ class DataFrameStatSuite extends QueryTest with SharedSQLContext { | |||
|
|
|||
| val resNaN1 = dfNaN.stat.approxQuantile("input1", Array(q1, q2), epsilon) | |||
| assert(resNaN1.count(_.isNaN) === 0) | |||
| assert(resNaN1.count(_ == null) === 0) | |||
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.
resNaN1 is an Array[Double] so can never contain null. This is always true and generated a warning
| @@ -20,6 +20,7 @@ package org.apache.spark.sql.streaming | |||
| import java.util.UUID | |||
|
|
|||
| import org.apache.spark.rdd.RDD | |||
| import org.apache.spark.sql.DataFrame | |||
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.
This whole file fix is already going into master separately as a hotfix
sql/hive-thriftserver/pom.xml
Outdated
| @@ -63,6 +63,16 @@ | |||
| <groupId>${hive.group}</groupId> | |||
| <artifactId>hive-beeline</artifactId> | |||
| </dependency> | |||
| <dependency> | |||
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.
For some reason, hive-thriftserver wouldn't compile, unable to find jetty.server classes. It has a point, these should explicit, even if it somehow worked before.
|
Test build #82033 has finished for PR 19307 at commit
|
|
retest this please |
|
Test build #82036 has finished for PR 19307 at commit
|
|
Good to see this passes, as I expected, because it means we can also commit this chunk of progress towards 2.12 without any downside for 2.11. Right now this means that the 2.12 build does compile, but I know it doesn't quite pass all tests (some weird paranamer problem, to start with) The only part I was slightly uncertain about was the change to sequenceFile implicits, but MiMa hasn't complained. Worth a look at the changes, but I think this is worth committing before too long. |
|
Test build #82076 has finished for PR 19307 at commit
|
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.
Up to my little knowledge, it looks good to me in general. What I checked was, to double check the comments left here and the same instances.
|
Merged to master |
What changes were proposed in this pull request?
Enable Scala 2.12 REPL. Fix most remaining issues with 2.12 compilation and warnings, including:
How was this patch tested?
Existing tests