SavicStefan commented on code in PR #53830:
URL: https://github.com/apache/spark/pull/53830#discussion_r2697930905
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalog.scala:
##########
@@ -154,29 +154,29 @@ class JDBCTableCatalog extends TableCatalog
override def loadTable(ident: Identifier): Table = {
JdbcUtils.withConnection(options) { conn =>
- if (!tableExists(ident, conn)) {
- throw QueryCompilationErrors.noSuchTableError(name(), ident)
- }
+ loadTable(ident, conn)
+ }
+ }
- val optionsWithTableName = new JDBCOptions(
- options.parameters + (JDBCOptions.JDBC_TABLE_NAME ->
getTableName(ident)))
- JdbcUtils.classifyException(
- condition = "FAILED_JDBC.LOAD_TABLE",
- messageParameters = Map(
- "url" -> options.getRedactUrl(),
- "tableName" -> toSQLId(ident)),
- dialect,
- description = s"Failed to load table: $ident",
- isRuntime = false
- ) {
- val remoteSchemaFetchMetric = JdbcUtils
- .createSchemaFetchMetric(SparkSession.active.sparkContext)
- val schema = SQLMetrics.withTimingNs(remoteSchemaFetchMetric) {
- JDBCRDD.resolveTable(optionsWithTableName, conn)
- }
- JDBCTable(ident, schema, optionsWithTableName,
- Map(JDBCRelation.schemaFetchKey -> remoteSchemaFetchMetric))
+ def loadTable(ident: Identifier, conn: Connection): Table = {
Review Comment:
This is needed because of the mock test that I added in
`JDBCTableCatalogSuite`.
--
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]