Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Returns the underlying SparkContext.
Syntax
sparkContext
Returns
SparkContext
Examples
:::note Serverless compatibility
spark.sparkContext is not available on Databricks Serverless compute. Use the spark (SparkSession) APIs directly: for example, spark.createDataFrame(...) in place of spark.sparkContext.parallelize(...).
:::
spark.sparkContext
# <SparkContext master=... appName=...>
# Create an RDD from the Spark context.
rdd = spark.sparkContext.parallelize([1, 2, 3])
rdd.collect()
# [1, 2, 3]