apache/spark — pull request #3262 by zsxwing (2014-11-14 07:50:53+00:00)
Title: [SPARK-4397][Core] Reorganize 'implicit's to improve the API convenience

This PR moved `implicit`s to `package object` and `companion object` to enable the Scala compiler search them automatically without explicit importing.

It should not break any API. I compiled the following codes with Spark 1.1.0:
```scala
import org.apache.spark.{SparkContext, SparkConf}
import org.apache.spark.SparkContext._

object ImplicitBackforwardCompatibilityApp {
def main(args: Array[String]): Unit = {
val conf = new SparkConf().setAppName("ImplicitBackforwardCompatibilityApp")
val sc = new SparkContext(conf)

val rdd = sc.parallelize(1 to 100).map(i => (i, i))
val rdd2 = rdd.groupByKey() // rddToPairRDDFunctions
val rdd3 = rdd2.sortByKey() // rddToOrderedRDDFunctions
val s1 = rdd3.map(_._1).stats() // numericRDDToDoubleRDDFunctions
println(s1)
val s2 = rdd3.map(_._1.toDouble).stats() // doubleRDDToDoubleRDDFunctions
println(s2)
val f = rdd2.countAsync() // rddToAsyncRDDActions
println(f.get())
rdd2.map { case (k, v) => (k, v.size) } saveAsSequenceFile("/tmp/test_path") // rddToSequenceFileRDDFunctions

val a1 = sc.accumulator(123.4) // DoubleAccumulatorParam
a1.add(1.0)
println(a1.value)
val a2 = sc.accumulator(123) // IntAccumulatorParam
a2.add(3)
println(a2.value)
val a3 = sc.accumulator(123L) // LongAccumulatorParam
a3.add(11L)
println(a3.value)
val a4 = sc.accumulator(123F) // FloatAccumulatorParam
a4.add(1.1F)
println(a4.value)

sc.stop()
}
}
```
And run it with this PR. It ran correctly.

However, for `WritableConverter`, I cannot make it work without `import`. Thoughts?