-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-46393][SQL][FOLLOWUP] Classify exceptions in JDBCTableCatalog.loadTable and Fix UT #46912
Conversation
Could you cherry-pick 82b4ad2 here to test the CI? |
Okay. |
…loadTable ### What changes were proposed in this pull request? This is a followup of apache#44335 , which missed to handle `loadTable` ### Why are the changes needed? better error message ### Does this PR introduce _any_ user-facing change? no ### How was this patch tested? existing test ### Was this patch authored or co-authored using generative AI tooling? no Closes apache#46905 from cloud-fan/jdbc. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Kent Yao <[email protected]>
Done. |
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.
+1, LGTM. Pending CIs
"url" -> options.getRedactUrl(), | ||
"tableName" -> toSQLId(ident)), | ||
dialect, | ||
description = s"Failed to load table: $ident" |
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.
@cloud-fan @yaooqinn
Also, do we need catalogname
as the prefix
for the table here?
Although I found this class JDBCTableCatalog.scala
, similar ones do not have this prefix
attached.
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'm fine to add catalog info. Let's do it in a separated PR, as not only loadTable
needs to be updated.
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.
Yeah, Let me to do it in a separated PR.
def checkErrorFailedLoadTable(e: AnalysisException, tbl: String): Unit = { | ||
checkError( | ||
exception = e, | ||
errorClass = "FAILED_JDBC.UNCLASSIFIED", |
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.
shouldn't this be LOAD_TABLE
?
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.
spark/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala
Lines 746 to 768 in 87b0f59
def classifyException( | |
e: Throwable, | |
errorClass: String, | |
messageParameters: Map[String, String], | |
description: String): AnalysisException = { | |
classifyException(description, e) | |
} | |
/** | |
* Gets a dialect exception, classifies it and wraps it by `AnalysisException`. | |
* @param message The error message to be placed to the returned exception. | |
* @param e The dialect specific exception. | |
* @return `AnalysisException` or its sub-class. | |
*/ | |
@deprecated("Please override the classifyException method with an error class", "4.0.0") | |
def classifyException(message: String, e: Throwable): AnalysisException = { | |
new AnalysisException( | |
errorClass = "FAILED_JDBC.UNCLASSIFIED", | |
messageParameters = Map( | |
"url" -> "jdbc:", | |
"message" -> message), | |
cause = Some(e)) | |
} |

It lost the upstream
errorClass
in this place
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.
It seems that we should correct it.
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.
If necessary, I handle it together with the prefix logic above?
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.
SGTM
thanks, merging to master! |
…ption` throw out the `original` exception ### What changes were proposed in this pull request? The pr aims to make `built-in` JdbcDialect's method classifyException throw out the `original` exception. ### Why are the changes needed? As discussed in #46912 (comment), the following code: https://github.com/apache/spark/blob/df4156aa3217cf0f58b4c6cbf33c967bb43f7155/sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala#L746-L751 have lost the original cause of the error, let's correct it. ### Does this PR introduce _any_ user-facing change? Yes, more accurate error conditions for end users. ### How was this patch tested? - Manually test. - Update existed UT & Pass GA. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #46937 from panbingkun/improve_JDBCTableCatalog. Authored-by: panbingkun <[email protected]> Signed-off-by: yangjie01 <[email protected]>
What changes were proposed in this pull request?
This is a followup of #46905, to fix
some UT
on GA.Why are the changes needed?
Fix UT.
Does this PR introduce any user-facing change?
No.,
How was this patch tested?
Manually test.
Pass GA
Was this patch authored or co-authored using generative AI tooling?
No.