QuestionQ38

VerifiedDeveloping Apache Spark™ DataFrame/DataSet API Applications

A developer is building a Spark application that carries out multiple DataFrame transformations and actions. The developer wants to preserve optimal performance by managing the SparkSession correctly.

How should the developer manage the SparkSession for the duration of the application?

Explanation

A single SparkSession should be reused for the application because it is the entry point for Spark’s DataFrame API and maintains the application’s shared Spark context and session state. Repeatedly stopping or creating sessions introduces unnecessary overhead, while SparkContext alone does not supply the DataFrame API.

Learn more

Community Discussion

No comments yet. Be the first to start the discussion!