Retrieve SparkContext from SparkSession
Just to post as an answer - the SparkContext can be accessed from SparkSession using spark.sparkContext
(no parenthesis)
The sparkContext field does not seem to be public anymore(I am using Spark 2.3.2), however, you can retreive it using a method of the same name:
spark.sparkContext()
This is applicable to Spark Java only.