[ https://issues.apache.org/jira/browse/SPARK-47123?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Hyukjin Kwon resolved SPARK-47123. ---------------------------------- Fix Version/s: 4.0.0 Resolution: Fixed Issue resolved by pull request 45209 [https://github.com/apache/spark/pull/45209] > JDBCRDD does not correctly handle errors in getQueryOutputSchema > ---------------------------------------------------------------- > > Key: SPARK-47123 > URL: https://issues.apache.org/jira/browse/SPARK-47123 > Project: Spark > Issue Type: Bug > Components: Spark Core > Affects Versions: 3.5.0, 4.0.0 > Reporter: Pablo Langa Blanco > Assignee: Pablo Langa Blanco > Priority: Minor > Labels: pull-request-available > Fix For: 4.0.0 > > > If there is an error executing statement.executeQuery(), it's possible that > another error in one of the finally statements makes us not see the main > error. > {code:java} > def getQueryOutputSchema( > query: String, options: JDBCOptions, dialect: JdbcDialect): StructType > = { > val conn: Connection = dialect.createConnectionFactory(options)(-1) > try { > val statement = conn.prepareStatement(query) > try { > statement.setQueryTimeout(options.queryTimeout) > val rs = statement.executeQuery() > try { > JdbcUtils.getSchema(rs, dialect, alwaysNullable = true, > isTimestampNTZ = options.preferTimestampNTZ) > } finally { > rs.close() > } > } finally { > statement.close() > } > } finally { > conn.close() > } > } {code} -- This message was sent by Atlassian Jira (v8.20.10#820010) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org