Skip to content

Conversation

khakhlyuk
Copy link
Contributor

@khakhlyuk khakhlyuk commented Sep 12, 2025

What changes were proposed in this pull request?

  1. This PR introduced a bug where SparkConnectGrpcException.grpc_status_code: grpc.StatusCode is set from status.code, which is an int. I am fixing this by setting it from rpc_error.code() which has the correct type.
  2. Errors without status don't contain the status codes, although it's always available for grpc exceptions. This is now fixed.
  3. There is an old bug where SparkConnectGrpcException._errorClass is set to "" instead of None, because info.metadata["errorClass"] == "INVALID_HANDLE.SESSION_CHANGED" populates it with "". Probably because info.metadata is a defaultdict(str) or smth similar. This is fixed by using info.metadata.get("errorClass") instead.
  4. added type hints for rpc_call, status_code and status to avoid type mismatch bugs in the future and make the code more readable.
  5. Added proper tests for grpc status code, error class and sql states.

Why are the changes needed?

Bug fixes

Does this PR introduce any user-facing change?

No

How was this patch tested?

New tests

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

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

Successfully merging this pull request may close these issues.

1 participant