SparkSession.builder.getOrCreate()
method is used to create a SparkSession object, which is the entry point to programming with Spark. A SparkSession provides a unified interface to work with structured data (DataFrames and Datasets) and allows you to configure various Spark properties. If a SparkSession already exists, getOrCreate()
returns the existing one; otherwise, it creates a new one.
spark.executor.memory
, spark.sql.shuffle.partitions
).local
, yarn
, k8s
).SparkSession.builder.getOrCreate()
method is used to create or retrieve a SparkSession object.