[SPARK-47708][CONNECT] Do not log gRPC exception to stderr in PySpark #45840
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?
Currently if there's any gRPC exception, instead of just handling it, the PySpark's gRPC error handler is going to print it out to the stderr, not allowing the user to cleanly ignore the exception by using try/except control flow statement.
In this PR we are removing the logger.exception call and we rely on the downstream exception mechanism to report this to the user.
Why are the changes needed?
Without this change, there's no way that the user ignores the gRPC error without piping the stderr to /dev/null or equivalent.
Does this PR introduce any user-facing change?
Yes, the stderr will not have the exception trace written twice.
How was this patch tested?
Existing tests.
Was this patch authored or co-authored using generative AI tooling?
No.