parallelize() method while using SparkSession in Spark 2.0

There is method of spark Context in the SparkSession Class

val data = spark.sparkContext.parallelize(Seq(1,2,3,4))
data: org.apache.spark.rdd.RDD[Int] = ParallelCollectionRDD[0] at parallelize at <console>:23

Once you build your SparkSession, you can fetch the underlying SparkContext created with it as followed :

Let's consider that SparkSession is already defined :

val spark : SparkSession = ??? 

You can get SparkContext now :

val sc = spark.sparkContext

Tags:

Apache Spark