beliefer commented on code in PR #39062:
URL: https://github.com/apache/spark/pull/39062#discussion_r1063070588
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -135,6 +135,20 @@ abstract class JdbcDialect extends Serializable with
Logging {
s""""$colName""""
}
+ /**
+ * Get the SQL query that should be used to create a table. Dialects can
+ * override this method to return a query that works best in a particular
database.
+ * @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.
Review Comment:
```suggestion
* @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.
```
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/JdbcDialects.scala:
##########
@@ -135,6 +135,20 @@ abstract class JdbcDialect extends Serializable with
Logging {
s""""$colName""""
}
+ /**
+ * Get the SQL query that should be used to create a table. Dialects can
+ * override this method to return a query that works best in a particular
database.
Review Comment:
```suggestion
* 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.
```
##########
sql/core/src/main/scala/org/apache/spark/sql/jdbc/MySQLDialect.scala:
##########
@@ -268,4 +268,11 @@ private case object MySQLDialect extends JdbcDialect with
SQLConfHelper {
throw QueryExecutionErrors.unsupportedDropNamespaceRestrictError()
}
}
+
+ override def createTable(
+ tableName: String,
+ strSchema: String,
+ createTableOptions: String): String = {
+ s"CREATE TABLE IF NOT EXIST $tableName ($strSchema) $createTableOptions"
Review Comment:
I think we should not change the syntax here and remove the override method.
##########
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/jdbc/JdbcUtils.scala:
##########
@@ -907,7 +907,7 @@ object JdbcUtils extends Logging with SQLConfHelper {
// 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"
Review Comment:
I think we should move the comment to default `createTable`.
--
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]