Commit db3323e
authored
Distinguish Arrow schema parsing failures from generic ResultSet errors (#1443)
## Summary
Arrow IPC schema deserialization failures on the Thrift metadata path
(`DatabricksThriftUtil.extractTypesFromArrowSchema`) previously surfaced
as the
generic `RESULT_SET_ERROR` (vendor code `1004`) with the enum name
`"RESULT_SET_ERROR"` stuffed into the SQLSTATE field. That made the
failure
indistinguishable in telemetry and in `SQLException.getSQLState()` /
`getErrorCode()` from unrelated ResultSet-shape mismatches
(`executeQuery` vs
`executeUpdate`, column-not-found, etc.).
This PR gives the failure its own driver error code and a proper
SQLSTATE:
- Adds `DatabricksDriverErrorCode.ARROW_SCHEMA_PARSING_ERROR` (vendor
code `22000`).
- Adds `DATA_EXCEPTION_SQLSTATE = "22000"` constant in
`DatabricksJdbcConstants`.
- Updates the call site in `DatabricksThriftUtil.java:427` to throw with
SQLSTATE
`22000` (Data Exception, per [Databricks SQLSTATE
docs](https://docs.databricks.com/aws/en/error-messages/sqlstates))
and the new internal code.
Notes on the value `22000`:
- Mirrors the SQLSTATE so the vendor code and SQLSTATE are
self-documenting and aligned.
- Sits well outside the MySQL/SQL Server vendor-code collision range
(e.g., MySQL `1045` = "Access denied"), unlike a sequential `1045` slot
in the existing enum.
The thrown exception's message is unchanged. The exception chain
(`cause`) is preserved.
## Test plan
- [ ] CI build/test green
- [ ] Manual verification: simulate a malformed Arrow schema response on
the Thrift metadata path and confirm `SQLException.getSQLState()` is
`"22000"` and `getErrorCode()` is `22000`
- [ ] Telemetry: confirm the new error code surfaces as
`ARROW_SCHEMA_PARSING_ERROR` rather than `RESULT_SET_ERROR`
Signed-off-by: samikshya-chand_data <samikshya.chand@databricks.com>1 parent a0cee89 commit db3323e
4 files changed
Lines changed: 12 additions & 2 deletions
File tree
- src/main/java/com/databricks/jdbc
- common
- util
- model/telemetry/enums
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| 17 | + | |
17 | 18 | | |
18 | 19 | | |
19 | 20 | | |
| |||
Lines changed: 3 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
119 | 122 | | |
120 | 123 | | |
121 | 124 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
424 | 425 | | |
425 | 426 | | |
426 | 427 | | |
427 | | - | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
428 | 433 | | |
429 | 434 | | |
430 | 435 | | |
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
| 48 | + | |
48 | 49 | | |
49 | 50 | | |
50 | 51 | | |
| |||
0 commit comments