[SPARK-58547][CONNECT] Expose operation IDs for end-to-end request attribution - #57747
Open
cloud-fan wants to merge 2 commits into
Open
[SPARK-58547][CONNECT] Expose operation IDs for end-to-end request attribution#57747cloud-fan wants to merge 2 commits into
cloud-fan wants to merge 2 commits into
Conversation
zhengruifeng
approved these changes
Aug 4, 2026
| * | ||
| * @since 4.3.0 | ||
| */ | ||
| val SPARK_CONNECT_OPERATION_ID_PROPERTY = "spark.connect.operation_id" |
uros-b
approved these changes
Aug 4, 2026
Member
|
Thank you @cloud-fan and @zhengruifeng! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Spark Connect's protocol includes an operation ID for identifying an
ExecutePlanrequest, butclients currently leave it unset unless callers explicitly provide one. This PR makes operation
IDs available throughout the request lifecycle:
ExecutePlanrequest.ExecutionInfo.operation_idafter successful execution andSparkConnectException.operation_idafter failure.ExecutePlanResponseand can retrieve it from failuresthrough
SparkConnectClient.getOperationId.SparkContext.SPARK_CONNECT_OPERATION_ID_PROPERTY.No protocol change is required, and callers that explicitly provide an operation ID retain the
existing behavior.
Why are the changes needed?
Successful requests can sometimes be correlated using the operation ID returned by the server.
That is insufficient for failures before the first response, because the caller never learns a
server-generated identifier.
Generating the identifier client-side provides a stable correlation key before the RPC begins.
The server propagates the same ID using Spark's existing local-property mechanism, making it
available to driver-side listeners and executor tasks. Applications and observability integrations
can therefore correlate client failures, server logs, Spark jobs, and tasks without depending on a
specific event system.
Does this PR introduce any user-facing change?
Yes. Spark Connect clients now generate operation IDs by default. Python users can access the ID
through execution information and exceptions; Scala users can access it through responses and
exceptions. Server-side integrations can access it through the public Spark local-property key.
How was this patch tested?
Added tests for generated operation IDs, Python session-hook preservation, successful execution
metadata, exceptions, and server-side local-property propagation.
Ran:
build/sbt 'connect-client-jvm/testOnly org.apache.spark.sql.connect.client.SparkConnectClientSuite'build/sbt 'connect/testOnly org.apache.spark.sql.connect.service.SparkConnectServiceE2ESuite'The focused Python test command was also invoked, but the configured local interpreter skipped the
Connect tests because pandas 2.2 or newer was unavailable.
Was this patch authored or co-authored using generative AI tooling?
Generated-by: OpenAI Codex (GPT-5)