[MINOR][CONNECT] Remove redundant user_context.user_id assignment in execute_command methods#57493
Open
ybapat wants to merge 1 commit into
Open
[MINOR][CONNECT] Remove redundant user_context.user_id assignment in execute_command methods#57493ybapat wants to merge 1 commit into
ybapat wants to merge 1 commit into
Conversation
…nt in execute_command methods _execute_plan_request_with_metadata() already sets req.user_context.user_id from self._user_id. The two execute_command methods were repeating this assignment immediately after the call, which is dead code. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
uros-b
approved these changes
Jul 24, 2026
uros-b
left a comment
Member
There was a problem hiding this comment.
Thank you @ybapat for dead code removal! cc @Yicong-Huang @HyukjinKwon
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?
Remove two redundant assignments of
req.user_context.user_id = self._user_idfromSparkConnectClient.execute_commandandSparkConnectClient.execute_command_as_iterator.Both methods call
_execute_plan_request_with_metadata()to build the request, and that helper already setsreq.user_context.user_idunder the identicalif self._user_id:guard. The subsequent reassignments in the two callers are dead code.Relates to GitHub issue #56408.
Why are the changes needed?
Dead code removal / readability improvement. Setting the same protobuf field to the same value twice in sequence is misleading — it implies the first assignment might not be sufficient when it is.
Does this PR introduce any user-facing change?
No. The resulting
req.user_context.user_idvalue is identical before and after this change.How was this patch tested?
No behavior change; existing Spark Connect unit tests cover
execute_command/execute_command_as_iteratorrequest construction.