Skip to content

Commit 2178e3f

Browse files
Adding test case for in with empty value list filter using mixed case column
1 parent 1765332 commit 2178e3f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

sql/core/src/test/scala/org/apache/spark/sql/jdbc/JDBCSuite.scala

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ class JDBCSuite extends SparkFunSuite
637637
assert(doCompileFilter(GreaterThanOrEqual("col0", 3)) === """"col0" >= 3""")
638638
assert(doCompileFilter(In("col1", Array("jkl"))) === """"col1" IN ('jkl')""")
639639
assert(doCompileFilter(In("col1", Array.empty)) ===
640-
"CASE WHEN col1 IS NULL THEN NULL ELSE FALSE END")
640+
"""CASE WHEN "col1" IS NULL THEN NULL ELSE FALSE END""")
641641
assert(doCompileFilter(Not(In("col1", Array("mno", "pqr"))))
642642
=== """(NOT ("col1" IN ('mno', 'pqr')))""")
643643
assert(doCompileFilter(IsNull("col1")) === """"col1" IS NULL""")
@@ -855,6 +855,8 @@ class JDBCSuite extends SparkFunSuite
855855
assert(sql("SELECT * FROM mixedCaseCols WHERE Name LIKE '%re%'").collect().size == 1)
856856
assert(sql("SELECT * FROM mixedCaseCols WHERE Name IS NULL").collect().size == 1)
857857
assert(sql("SELECT * FROM mixedCaseCols WHERE Name IS NOT NULL").collect().size == 2)
858+
assert(sql("SELECT * FROM mixedCaseCols")
859+
.filter($"Name".isin(Array[String]() : _*)).collect().size == 0)
858860
assert(sql("SELECT * FROM mixedCaseCols WHERE Name IN ('mary', 'fred')").collect().size == 2)
859861
assert(sql("SELECT * FROM mixedCaseCols WHERE Name NOT IN ('fred')").collect().size == 1)
860862
assert(sql("SELECT * FROM mixedCaseCols WHERE Id = 1 OR Name = 'mary'").collect().size == 2)

0 commit comments

Comments
 (0)