Skip to content

Commit 67a037c

Browse files
committed
Update test cases.
1 parent c72aa18 commit 67a037c

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2651,10 +2651,13 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
26512651
sql("SELECT struct(1 a) UNION ALL (SELECT struct(2 A))")
26522652
sql("SELECT struct(1 a) EXCEPT (SELECT struct(2 A))")
26532653

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)
2654+
withTable("t", "S") {
2655+
sql("CREATE TABLE t(c struct<f:int>) USING parquet")
2656+
sql("CREATE TABLE S(C struct<F:int>) USING parquet")
2657+
Seq(("c", "C"), ("C", "c"), ("c.f", "C.F"), ("C.F", "c.f")).foreach {
2658+
case (left, right) =>
2659+
checkAnswer(sql(s"SELECT * FROM t, S WHERE t.$left = S.$right"), Seq.empty)
2660+
}
26582661
}
26592662
}
26602663

@@ -2669,13 +2672,14 @@ class SQLQuerySuite extends QueryTest with SharedSQLContext {
26692672
}.message
26702673
assert(m2.contains("Except can only be performed on tables with the compatible column types"))
26712674

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+
withTable("t", "S") {
2676+
sql("CREATE TABLE t(c struct<f:int>) USING parquet")
2677+
sql("CREATE TABLE S(C struct<F:int>) USING parquet")
2678+
checkAnswer(sql("SELECT * FROM t, S WHERE t.c.f = S.C.F"), Seq.empty)
26752679
val m = intercept[AnalysisException] {
2676-
sql("SELECT * FROM struct1, struct2 WHERE a = A")
2680+
sql("SELECT * FROM t, S WHERE c = C")
26772681
}.message
2678-
assert(m.contains("cannot resolve '(struct1.`a` = struct2.`A`)' due to data type mismatch"))
2682+
assert(m.contains("cannot resolve '(t.`c` = S.`C`)' due to data type mismatch"))
26792683
}
26802684
}
26812685
}

0 commit comments

Comments
 (0)