LuciferYang commented on code in PR #40531:
URL: https://github.com/apache/spark/pull/40531#discussion_r1147130110
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/jdbc/JDBCTableCatalogSuite.scala:
##########
@@ -452,4 +452,18 @@ class JDBCTableCatalogSuite extends QueryTest with
SharedSparkSession {
assert(m.contains("\"TABLEENGINENAME\" not found"))
}
}
+
+ test("SPARK-42904: CREATE TABLE with char/varchar") {
+ withTable("h2.test.new_table") {
+ sql("CREATE TABLE h2.test.new_table(c CHAR(10), v VARCHAR(100))")
+ checkAnswer(sql("SHOW TABLES IN h2.test LIKE 'new*'"), Row("test",
"new_table", false))
+ }
+ }
+
+ test("SPARK-42904: CREATE TABLE with char/varchar with invalid char length")
{
+ val e = intercept[AnalysisException]{
+ sql("CREATE TABLE h2.test.new_table(c CHAR(1000000001))")
+ }
+ assert(e.getCause.getMessage.contains("1000000001"))
+ }
Review Comment:
should we also add a `VARCHAR` case? like
```
sql("CREATE TABLE h2.test.new_table(c VARCHAR(1000000001))")
```
?
--
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]