You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "urosstan-db (via GitHub)" <gi...@apache.org> on 2026/01/16 10:22:12 UTC
Re: [PR] [SPARK-55065] Avoid making two JDBC API calls [spark]
urosstan-db commented on code in PR #53830:
URL: https://github.com/apache/spark/pull/53830#discussion_r2697898894
##########
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:
Is there a need for the introduction of a new method here?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org