ybapat opened a new pull request, #57493:
URL: https://github.com/apache/spark/pull/57493

   ### What changes were proposed in this pull request?
   
   Remove two redundant assignments of `req.user_context.user_id = 
self._user_id` from `SparkConnectClient.execute_command` and 
`SparkConnectClient.execute_command_as_iterator`.
   
   Both methods call `_execute_plan_request_with_metadata()` to build the 
request, and that helper already sets `req.user_context.user_id` under the 
identical `if self._user_id:` guard. The subsequent reassignments in the two 
callers are dead code.
   
   ```python
   # _execute_plan_request_with_metadata() already does this:
   if self._user_id:
       req.user_context.user_id = self._user_id
   
   # These lines in execute_command / execute_command_as_iterator were 
redundant:
   - if self._user_id:
   -     req.user_context.user_id = self._user_id
   ```
   
   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_id` value 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_iterator` request construction.
   
   > This PR was created with the assistance of Claude (AI). Disclosed per 
Apache Spark contribution guidelines.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to