-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-46410][SQL] Assign error classes/subclasses to JdbcUtils.classifyException #44358
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
50a7936
8c6158e
d7302f2
d3204c7
f9072ae
901c511
9b0090f
be74430
c9a23f5
707c212
d21fb1e
2e8eeb0
01a1a9c
0338fbc
06fbd90
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
--- | ||
layout: global | ||
title: FAILED_JDBC error class | ||
displayTitle: FAILED_JDBC error class | ||
license: | | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--- | ||
|
||
SQLSTATE: HV000 | ||
|
||
Failed JDBC `<url>` on the operation: | ||
|
||
This error class has the following derived error classes: | ||
|
||
## ALTER_TABLE | ||
|
||
Alter the table `<tableName>`. | ||
|
||
## CREATE_INDEX | ||
|
||
Create the index `<indexName>` in the `<tableName>` table. | ||
|
||
## CREATE_NAMESPACE | ||
|
||
Create the namespace `<namespace>`. | ||
|
||
## CREATE_NAMESPACE_COMMENT | ||
|
||
Create a comment on the namespace: `<namespace>`. | ||
|
||
## CREATE_TABLE | ||
|
||
Create the table `<tableName>`. | ||
|
||
## DROP_INDEX | ||
|
||
Drop the index `<indexName>` in the `<tableName>` table. | ||
|
||
## DROP_NAMESPACE | ||
|
||
Drop the namespace `<namespace>`. | ||
|
||
## GET_TABLES | ||
|
||
Get tables from the namespace: `<namespace>`. | ||
|
||
## LIST_NAMESPACES | ||
|
||
List namespaces. | ||
|
||
## NAMESPACE_EXISTS | ||
|
||
Check that the namespace `<namespace>` exists. | ||
|
||
## REMOVE_NAMESPACE_COMMENT | ||
|
||
Remove a comment on the namespace: `<namespace>`. | ||
|
||
## RENAME_TABLE | ||
|
||
Rename the table `<oldName>` to `<newName>`. | ||
|
||
## TABLE_EXISTS | ||
|
||
Check that the table `<tableName>` exists. | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1180,12 +1180,15 @@ object JdbcUtils extends Logging with SQLConfHelper { | |
} | ||
} | ||
|
||
def classifyException[T](message: String, dialect: JdbcDialect)(f: => T): T = { | ||
def classifyException[T]( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a breaking change, isn't it? JDBCDialect is a public developer API. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. when was this API added? @beliefer do you know? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perhaps we should keep two versions. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. And how will you combine exceptions from the both versions? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there are no nested exception here. We pass a default error class to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So if a dialect can classify an exception, we will lose the error class which is actually worse? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we also enable MiMa for this? I believe this is being skipped because it's under There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
@cloud-fan A dialect can override proposed error class and make our default error class more precise using the driver specific info. And yes, the original error class will be lost.
@HyukjinKwon I made the modification because MiMa complained. Did you change MiMa to expect different behaviour? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think losing the original error class is bad. We added |
||
errorClass: String, | ||
messageParameters: Map[String, String], | ||
dialect: JdbcDialect)(f: => T): T = { | ||
try { | ||
f | ||
} catch { | ||
case e: SparkThrowable with Throwable => throw e | ||
case e: Throwable => throw dialect.classifyException(message, e) | ||
case e: Throwable => throw dialect.classifyException(e, errorClass, messageParameters) | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FAILED_JDBC
->FAILED_JDBC_OPERATION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Too long, does
_OPERATION
bring any benefits?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just because
FAILED_JDBC
looks confused.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JDBC means Java Database Connectivity, the connectivity might fails at any time, ops or while establishing connections or while keeping it. For instance, this is real example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess the connectivity is not changed if
create index failed