-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-33074][SQL] Classify dialect exceptions in JDBC v2 Table Catalog #29952
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
Conversation
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #129439 has finished for PR 29952 at commit
|
@HyukjinKwon @cloud-fan @maropu @huaxingao Could you review this PR, please. |
I think of to continue with this after #29957 |
…eption # Conflicts: # sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala # sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #129502 has finished for PR 29952 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status success |
@HyukjinKwon @cloud-fan @maropu @huaxingao I think this PR is ready for review. Please, have a look at it. |
@@ -70,7 +70,9 @@ class JDBCTableCatalog extends TableCatalog with Logging { | |||
checkNamespace(ident.namespace()) | |||
val writeOptions = new JdbcOptionsInWrite( | |||
options.parameters + (JDBCOptions.JDBC_TABLE_NAME -> getTableName(ident))) | |||
withConnection(JdbcUtils.tableExists(_, writeOptions)) | |||
classifyException(s"Failed table existence check: $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.
shall we be consistent and always put classifyException
inside withConnection
?
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 don't think that mixing two conceptually different things will make them consistent.
@@ -297,6 +308,7 @@ object JdbcDialects { | |||
registerDialect(DerbyDialect) | |||
registerDialect(OracleDialect) | |||
registerDialect(TeradataDialect) | |||
registerDialect(H2Dialect) |
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.
since we already have a testH2Dialect
, how about we update testH2Dialect
to implement classifyException
, and use it in JDBCTableCatalogSuite
? Then we don't need to have an official H2Dialect
.
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 you look at testH2Dialect
, it has test specific settings. Why should we have the settings in JDBCTableCatalogSuite
?
Then we don't need to have an official
H2Dialect
.
What is the problem to have built-in H2Dialect?
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.
Probably, not related to this. If we don't want to support H2 officially as a dialect, why do we test it so broadly in Spark.?Maybe it makes sense to switch all internal Spark tests to Derby?
Test build #129513 has finished for PR 29952 at commit
|
thanks, merging to master! |
What changes were proposed in this pull request?
JdbcDialect
class -classifyException()
. It converts dialect specific exception to Spark'sAnalysisException
or its sub-classes.org.h2.jdbc.JdbcSQLException
inJDBCTableCatalogSuite
byAnalysisException
.H2Dialect
Why are the changes needed?
Currently JDBC v2 Table Catalog implementation throws dialect specific exception and ignores exceptions defined in the
TableCatalog
interface. This PR adds new method for converting dialect specific exception, and assumes that follow up PRs will implementclassifyException()
.Does this PR introduce any user-facing change?
Yes.
How was this patch tested?
By running existing test suites
JDBCTableCatalogSuite
andJDBCV2Suite
.