Skip to content

[Minor] Update SparkSessionBuilder.create to use existing SparkContext if it already exists#1

Open
jonmio wants to merge 7 commits into
py4j-whitelistfrom
jonmio-unify-create-and-getOrCreate
Open

[Minor] Update SparkSessionBuilder.create to use existing SparkContext if it already exists#1
jonmio wants to merge 7 commits into
py4j-whitelistfrom
jonmio-unify-create-and-getOrCreate

Conversation

@jonmio

@jonmio jonmio commented Feb 23, 2026

Copy link
Copy Markdown
Owner

What changes were proposed in this pull request?

As titled this is a minor hygiene improvement which brings the create and getOrCreate codepaths closer together. Prior to this PR, the create codepath would always create a new SparkConf and pass that to SparkContext.getOrCreate. This is not necessary and diverges from the getOrCreate codepath when a session/SparkContext already exists.

Why are the changes needed?

Code hygene

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests are sufficient here

Was this patch authored or co-authored using generative AI tooling?

No

@jonmio jonmio changed the title Refactor create to mirror getOrCreate [Minor] Update SparkSessionBuilder.create to use existing SparkContext if it already exists Feb 23, 2026
Add test to ensure SparkConf is not called when a session exists.
Add test to verify mutable SQL configs are applied per session.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant