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


##########
sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala:
##########
@@ -2206,4 +2206,40 @@ class JDBCSuite extends QueryTest with 
SharedSparkSession {
       JdbcUtils.schemaString(dialect, schema, caseSensitive = false, Some("b 
boolean"))
     assert(schemaStr === """"b" NUMBER(1) """)
   }
+
+  test("SPARK-50666: reading hint test") {
+    // hint format check
+    Seq("INDEX(test idx1) */", "/*+ INDEX(test idx1)", "").foreach { hint =>
+      val e = intercept[IllegalArgumentException] {
+        val options = new JDBCOptions(Map("url" -> "jdbc:h2://host:port", 
"dbtable" -> "test",
+          "hint" -> hint))
+      }.getMessage
+      assert(e.contains(s"Invalid value `$hint` for option `hint`." +
+        s" It should start with `/*+ ` and end with ` */`."))
+    }
+
+    // dialect supported check
+    // JDBC url is a required option but is not used in this test.
+    val options = new JDBCOptions(Map("url" -> "jdbc:h2://host:port", 
"dbtable" -> "test",

Review Comment:
   OK.
   We can fix it in this way
   https://github.com/apache/spark/pull/49564/files#r1929762553



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