viirya commented on a change in pull request #29324:
URL: https://github.com/apache/spark/pull/29324#discussion_r464791154
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala
##########
@@ -900,10 +889,52 @@ object JdbcUtils extends Logging {
newTable: String,
options: JDBCOptions): Unit = {
val dialect = JdbcDialects.get(options.url)
+ executeStatement(conn, options, dialect.renameTable(oldTable, newTable))
+ }
+
+ /**
+ * Update a table from the JDBC database.
+ */
+ def alterTable(
+ conn: Connection,
+ tableName: String,
+ changes: Seq[TableChange],
+ options: JDBCOptions): Unit = {
+ val dialect = JdbcDialects.get(options.url)
+ if (changes.length == 1) {
+ executeStatement(conn, options, dialect.alterTable(tableName,
changes)(0))
+ } else {
+ val metadata = conn.getMetaData
+ if (!metadata.supportsTransactions) {
+ throw new
SQLFeatureNotSupportedException(s"${this.getClass.getName}.alterTable doesn't" +
+ s" support multiple alter table changes simultaneously for database
server" +
+ s" that doesn't have transaction support.")
Review comment:
No need s"" 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.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]