Skip to content

Commit d684a0f

Browse files
committed
Add one more test case.
1 parent d0b82e6 commit d684a0f

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetSchemaPruningSuite.scala

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,14 @@ class ParquetSchemaPruningSuite
5050
val johnDoe = FullName("John", "Y.", "Doe")
5151
val susanSmith = FullName("Susan", "Z.", "Smith")
5252

53-
val company = Employer(0, Company("abc", "123 Business Street"))
53+
val employer = Employer(0, Company("abc", "123 Business Street"))
54+
val employerWithNullCompany = Employer(1, null)
5455

5556
private val contacts =
5657
Contact(0, janeDoe, "123 Main Street", 1, friends = Array(susanSmith),
57-
relatives = Map("brother" -> johnDoe), employer = company) ::
58-
Contact(1, johnDoe, "321 Wall Street", 3, relatives = Map("sister" -> janeDoe)) :: Nil
58+
relatives = Map("brother" -> johnDoe), employer = employer) ::
59+
Contact(1, johnDoe, "321 Wall Street", 3, relatives = Map("sister" -> janeDoe),
60+
employer = employerWithNullCompany) :: Nil
5961

6062
case class Name(first: String, last: String)
6163
case class BriefContact(id: Int, name: Name, address: String)
@@ -183,6 +185,13 @@ class ParquetSchemaPruningSuite
183185
checkAnswer(query4, Row("Jane", "abc") :: Nil)
184186
}
185187

188+
testSchemaPruning("select nullable complex field and having is null predicate") {
189+
val query = sql("select employer.company from contacts " +
190+
"where employer is not null and p = 1")
191+
checkScan(query, "struct<employer:struct<company:struct<name:string,address:string>>>")
192+
checkAnswer(query, Row(Row("abc", "123 Business Street")) :: Row(null) :: Nil)
193+
}
194+
186195
testSchemaPruning("select a single complex field and is null expression in project") {
187196
val query = sql("select name.first, address is not null from contacts")
188197
checkScan(query, "struct<name:struct<first:string>,address:string>")

0 commit comments

Comments
 (0)