Comprehensive and Detailed Explanation From Exact Extract:
According to the PySpark API documentation:
"getOrCreate(): Gets an existing SparkSession or, if there is no existing one, creates a new one based on the options set in this builder."
This means Spark maintains a global singleton session within a JVM process. Repeated calls togetOrCreate()return the same session, unless explicitly stopped.
Option A is incorrect: the method does not destroy any session.
Option B incorrectly ties uniqueness toappName, which does not influence session reusability.
Option D is incorrect: it contradicts the fundamental behavior ofgetOrCreate().
(Source:PySpark SparkSession API Docs)
Contribute your Thoughts:
Chosen Answer:
This is a voting comment (?). You can switch to a simple comment. It is better to Upvote an existing comment if you don't have anything to add.
Submit