HyukjinKwon opened a new pull request #34219:
URL: https://github.com/apache/spark/pull/34219
### What changes were proposed in this pull request?
This PR proposes to leverage the error message framework by exposing the
methods below:
- `getErrorClass`
- `getSqlState`
at captured PySpark SQL exceptions (from `SparkThrowable`).
In addition, this PR adds a bit of refactoring. Previously the exception
capture was done by string comparison which is flaky. Now, the logic leverages
`isInstanceOf` on JVM.
### Why are the changes needed?
Users can leverage the error class and SQL state codes by:
```python
try:
...
except AnalysisException as e:
if e.getSqlState.startswith("4"):
...
```
### Does this PR introduce _any_ user-facing change?
Yes, users now can get `getErrorClass` and `getSqlState` from SQL exceptions.
### How was this patch tested?
Manually tested, and unittests were added.
--
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]