I'm new in Scala
Here's what I'm trying to understand
This code snippet gives me RDD[Int], not give option to use toDF
var input = spark.sparkContext.parallelize(List(1,2,3,4,5,6,7,8,9))
But when I import import spark.sqlContext.implicits._
, it gives me an option to use toDF
import spark.sqlContext.implicits._
var input = spark.sparkContext.parallelize(List(1,2,3,4,5,6,7,8,9)).toDF
So I looked into the source code, implicits
is present in SQLContext
class as object
. I'm not able to understand, how come RDD
instance is able to call toDF
after import ?
Can anyone help me to understand ?
update
found below code snippet in SQLContext class
object implicits extends SQLImplicits with Serializable {
protected override def _sqlContext: SQLContext = self
}