You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "beliefer (via GitHub)" <gi...@apache.org> on 2023/02/16 02:43:41 UTC

[GitHub] [spark] beliefer commented on a diff in pull request #39062: [SPARK-41516] [SQL] Allow jdbc dialects to override the query used to create a table

beliefer commented on code in PR #39062:
URL: https://github.com/apache/spark/pull/39062#discussion_r1059631845


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -1963,4 +1963,20 @@ class JDBCSuite extends QueryTest with SharedSparkSession {
       }
     }
   }
+
+  test("SPARK-41516:  dialect override the method of createTable") {
+    val dialect = new JdbcDialect {
+      override def canHandle(url: String) : Boolean = url.startsWith("jdbc:h2:")
+      override def createTable(
+          tableName: String,
+          strSchema: String,
+          createTableOptions: String): String = {
+        s"CREATE TABLE IF NOT EXIST $tableName ($strSchema) $createTableOptions"

Review Comment:
   eh. My mean is you can add the function to https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/jdbc/MySQLDialect.scala or other supported *Dialect. We should prove this PR could works well in real scene.



-- 
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