MaxGekk commented on code in PR #44358:
URL: https://github.com/apache/spark/pull/44358#discussion_r1428356377
##########
common/utils/src/main/resources/error/error-classes.json:
##########
@@ -1096,6 +1096,79 @@
],
"sqlState" : "38000"
},
+ "FAILED_JDBC" : {
+ "message" : [
+ "Failed the JDBC operation:"
+ ],
+ "subClass" : {
+ "ALTER_TABLE" : {
+ "message" : [
+ "Alter the table <tableName>."
+ ]
+ },
+ "CREATE_INDEX" : {
+ "message" : [
+ "Create the index <indexName> in the <tableName> table."
+ ]
+ },
+ "CREATE_NAMESPACE" : {
+ "message" : [
+ "Create the namespace <namespace>."
+ ]
+ },
+ "CREATE_NAMESPACE_COMMENT" : {
+ "message" : [
+ "Create a comment on the namespace: <namespace>."
+ ]
+ },
+ "CREATE_TABLE" : {
+ "message" : [
+ "Create the table <tableName>."
+ ]
+ },
+ "DROP_INDEX" : {
+ "message" : [
+ "Drop the index <indexName> in the <tableName> table."
+ ]
+ },
+ "DROP_NAMESPACE" : {
+ "message" : [
+ "Drop the namespace <namespace>."
+ ]
+ },
+ "GET_TABLES" : {
+ "message" : [
+ "Get tables from the namespace: <namespace>."
+ ]
+ },
+ "LIST_NAMESPACES" : {
+ "message" : [
+ "List namespaces."
+ ]
+ },
+ "NAMESPACE_EXISTS" : {
+ "message" : [
+ "Check that the namespace <namespace> exists."
+ ]
+ },
+ "REMOVE_NAMESPACE_COMMENT" : {
+ "message" : [
+ "Remove a comment on the namespace: <namespace>."
+ ]
+ },
+ "RENAME_TABLE" : {
+ "message" : [
+ "Rename the table <oldName> to <newName>."
+ ]
+ },
+ "TABLE_EXISTS" : {
+ "message" : [
+ "Check that the table <tableName> exists."
+ ]
+ }
+ },
+ "sqlState" : "40000"
Review Comment:
> This is all about reaching out to foreign data right?
Right.
> HV000 FDW-specific condition?
Seems like, but what do you propose? to get `sqlState` from `SQLExpression`?
> Is it obvious from the context what we are connecting to?
Should be if an user reads data from one JDBC datasource.
> Should we add some JDBC level context (URL?)
I can extract and pass `option.url` to `AnalysisException` with new error
class `FAILED_JDBC` but how about other (classified exceptions) like:
```
case "42P07" =>
if (errorClass == "FAILED_JDBC.CREATE_INDEX") {
throw new IndexAlreadyExistsException(
indexName = messageParameters("indexName"),
tableName = messageParameters("tableName"),
cause = Some(e))
```
The `IndexAlreadyExistsException` has its own error class
`INDEX_ALREADY_EXISTS` without any parameters related to JDBC url.
--
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]