I am importing SparkSession
as follows in PySpark:
from pyspark.sql import SparkSession
Then I create SparkSession
:
spark = SparkSession.builder.appName("test").getOrCreate()
and try to access SparkContext
:
spark.SparkContext.broadcast(...)
However, I get an error that SparkContext
does not exist. How can I access it in order to set broadcast
variables?