Skip to content

[SPARK-56111][CORE] Add SparkContext.isDriver() and use it across the codebase#54922

Open
cloud-fan wants to merge 2 commits intoapache:masterfrom
cloud-fan:SPARK-53915-followup
Open

[SPARK-56111][CORE] Add SparkContext.isDriver() and use it across the codebase#54922
cloud-fan wants to merge 2 commits intoapache:masterfrom
cloud-fan:SPARK-53915-followup

Conversation

@cloud-fan
Copy link
Contributor

@cloud-fan cloud-fan commented Mar 20, 2026

What changes were proposed in this pull request?

Add a SparkContext.isDriver(executorId) utility method and replace all manual executorId == SparkContext.DRIVER_IDENTIFIER / executorId != SparkContext.DRIVER_IDENTIFIER checks across the codebase with it.

Why are the changes needed?

The driver-detection pattern executorId == SparkContext.DRIVER_IDENTIFIER is duplicated in ~20 places across core, SQL, streaming, profiler, and Kubernetes modules. Centralizing it in a single method improves readability and reduces duplication.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Existing tests — this is a pure refactoring with no behavior change.

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

Generated-by: Claude Opus 4.6

@cloud-fan cloud-fan changed the title [MINOR] Use SparkContext.isDriver() in GlobalSingletonManualClock [MINOR] Add SparkContext.isDriver() and use it across the codebase Mar 20, 2026
@cloud-fan cloud-fan changed the title [MINOR] Add SparkContext.isDriver() and use it across the codebase [SPARK-56111][CORE] Add SparkContext.isDriver() and use it across the codebase Mar 20, 2026
@cloud-fan
Copy link
Contributor Author

cc @Ngone51

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants