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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCV2Suite.scala:
##########
@@ -2692,4 +2693,37 @@ class JDBCV2Suite extends QueryTest with 
SharedSparkSession with ExplainSuiteHel
       JdbcDialects.registerDialect(H2Dialect)
     }
   }
+
+  test("SPARK-41516: Allow jdbc dialects to override the query used to create 
a table") {
+    val customDialect = new JdbcDialect {
+      override def canHandle(url: String): Boolean = H2Dialect.canHandle(url)
+
+      override def createTable(
+          statement: Statement,
+          tableName: String,
+          strSchema: String,
+          options: JdbcOptionsInWrite): Unit = {
+        val createTableOptions = options.createTableOptions
+        statement.executeUpdate(
+          s"CREATE TABLE IF NOT EXISTS $tableName ($strSchema) 
$createTableOptions")

Review Comment:
   I'm a bit confused. How do you verify the generated CREATE TABLE SQL is 
expected? If there is no easy way to test, we can remove this test as it's 
obvious that people can customize the CREATE TABLE SQL now and existing tests 
make sure CREATE TABLE still works in all builtin dialects.



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