Retrieve SparkContext from SparkSession

后端 未结 2 1097
闹比i
闹比i 2021-02-18 23:09

I\'m running a spark batch job and uses SparkSession as I need a lot of spark-sql features to process in each of my components. The SparkContext is in

2条回答
  •  生来不讨喜
    2021-02-18 23:50

    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.

提交回复
热议问题