cloud-fan commented on code in PR #39062:
URL: https://github.com/apache/spark/pull/39062#discussion_r1112517669


##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -135,6 +135,38 @@ abstract class JdbcDialect extends Serializable with 
Logging {
     s""""$colName""""
   }
 
+  /**
+   * Get the SQL that should be used to create a table. Dialects can
+   * override this method to return a SQL that works best in a particular 
database.
+   * To allow certain options to append when create a new table, which can be
+   * table_options or partition_options.
+   * E.g., "CREATE TABLE t (name string) ENGINE=InnoDB DEFAULT CHARSET=utf8"
+   * @param tableName The name of the table.
+   * @param strSchema The scheme string corresponding to the dialect, the 
schemaString method of
+   *                  JdbcUtils has provided the function of calculating the 
scheme string
+   *                  for different databases
+   * @param createTableOptions The string of the options that to allow certain 
options to append
+   *                           when create a new table, which can be 
table_options
+   *                           or partition_options.
+   */
+  def createTable(
+      statement: Statement,
+      tableName: String,
+      strSchema: String,
+      options: JdbcOptionsInWrite): Unit = {
+    val createTableQuery = getCreateTableQuery(tableName, strSchema, 
options.createTableOptions)

Review Comment:
   `getAddColumnQuery` is used by `alterTable`. The idea is, `alterTable` has 
many parts and it's too much to override `alterTable` if only the ADD COLUMN 
syntax needs to be adjusted.
   
   Can we follow `createSchema` 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: [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]

Reply via email to