dongjoon-hyun opened a new pull request, #474:
URL: https://github.com/apache/spark-connect-swift/pull/474

   ### What changes were proposed in this pull request?
   
   This PR improves `SparkConnectError` to carry error details and replaces 
message-substring-based
   error classification with `google.rpc.ErrorInfo` parsing.
   
   1. Each `SparkConnectError` case now carries a `Details` payload (`message`, 
`errorClass`,
      `sqlState`, `messageParameters`). The cases are renamed to 
`lowerCamelCase` while the original
      spellings are kept as compatibility static properties, so the existing 
`throw`/`catch`/
      `#expect(throws:)` call sites continue to compile unchanged.
   2. A new `GrpcErrorConverter` classifies errors by the Spark error class 
from `ErrorInfo` of the
      gRPC status details, like the PySpark and Scala clients. 
Message-substring matching remains only
      as a fallback.
   3. The three duplicated substring-matching sites 
(`SparkConnectClient.withGPRC`,
      `DataFrame.withGPRC`, `ddlParse`) are unified into the converter.
   
   ### Why are the changes needed?
   
   Users could not access the server error message, error class, or SQLSTATE 
from a caught error, and
   the classification relied on fragile substring matching duplicated in three 
places.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, `SparkConnectError` provides detailed error information now.
   
   ```swift
   } catch SparkConnectError.tableOrViewNotFound(let details) {
     print(details.errorClass)  // Optional("TABLE_OR_VIEW_NOT_FOUND")
     print(details.sqlState)    // Optional("42P01")
   }
   ```
   
   The existing code using the original case spellings continues to compile and 
behave the same.
   
   ### How was this patch tested?
   
   Pass the CIs with the newly added `SparkConnectErrorTests` test suite. All 
existing test suites pass
   unmodified, which proves the source compatibility of this change.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Fable 5


-- 
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