Github user gatorsmile commented on a diff in the pull request:
https://github.com/apache/spark/pull/19747#discussion_r152734026
--- Diff:
sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala
---
@@ -174,6 +174,87 @@ class HiveCatalogedDDLSuite extends DDLSuite with
TestHiveSingleton with BeforeA
test("alter datasource table add columns - partitioned - orc") {
testAddColumnPartitioned("orc")
}
+
+ test("SPARK-22431: illegal nested type") {
+ val queries = Seq(
+ "CREATE TABLE t AS SELECT STRUCT('a' AS `$a`, 1 AS b) q",
+ "CREATE TABLE t(q STRUCT<`$a`:INT, col2:STRING>, i1 INT)",
+ "CREATE VIEW t AS SELECT STRUCT('a' AS `$a`, 1 AS b) q")
+
+ queries.foreach(query => {
+ val err = intercept[AnalysisException] {
+ spark.sql(query)
+ }.getMessage
+ assert(err.contains("Cannot recognize the data type"))
+ })
+
+ withView("v") {
+ spark.sql("CREATE VIEW v AS SELECT STRUCT('a' AS `a`, 1 AS b) q")
+ assert(spark.sql("SELECT * FROM v").count() == 1L)
--- End diff --
The same applies to the other test cases
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]