Skip to content

Commit c72aa18

Browse files
committed
Add test cases.
1 parent b2d1338 commit c72aa18

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

sql/core/src/test/scala/org/apache/spark/sql/SQLQuerySuite.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2650,6 +2650,12 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
26502650
withSQLConf(SQLConf.CASE_SENSITIVE.key -> "false") {
26512651
sql("SELECT struct(1 a) UNION ALL (SELECT struct(2 A))")
26522652
sql("SELECT struct(1 a) EXCEPT (SELECT struct(2 A))")
2653+
2654+
withTable("struct1", "struct2") {
2655+
sql("CREATE TABLE struct1(a struct<a:int>) USING parquet")
2656+
sql("CREATE TABLE struct2(A struct<A:int>) USING parquet")
2657+
checkAnswer(sql("SELECT * FROM struct1, struct2 WHERE struct1.a = struct2.A"), Seq.empty)
2658+
}
26532659
}
26542660

26552661
withSQLConf(SQLConf.CASE_SENSITIVE.key -> "true") {
@@ -2662,6 +2668,15 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
26622668
sql("SELECT struct(1 a) EXCEPT (SELECT struct(2 A))")
26632669
}.message
26642670
assert(m2.contains("Except can only be performed on tables with the compatible column types"))
2671+
2672+
withTable("struct1", "struct2") {
2673+
sql("CREATE TABLE struct1(a struct<a:int>) USING parquet")
2674+
sql("CREATE TABLE struct2(A struct<A:int>) USING parquet")
2675+
val m = intercept[AnalysisException] {
2676+
sql("SELECT * FROM struct1, struct2 WHERE a = A")
2677+
}.message
2678+
assert(m.contains("cannot resolve '(struct1.`a` = struct2.`A`)' due to data type mismatch"))
2679+
}
26652680
}
26662681
}
26672682

0 commit comments

Comments
 (0)