Github user yucai commented on a diff in the pull request:
https://github.com/apache/spark/pull/20851#discussion_r175839248
--- Diff:
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFilterSuite.scala
---
@@ -313,6 +316,36 @@ class ParquetFilterSuite extends QueryTest with
ParquetTest with SharedSQLContex
}
}
+ test("filter pushdown - date") {
+ implicit class IntToDate(int: Int) {
--- End diff --
Ok, do you mean this way? Looks like we need more words :).
```
implicit class StringToDate(s: String) {
def d: Date = Date.valueOf(s)
}
withParquetDataFrame(
Seq("2017-08-18", "2017-08-19", "2017-08-20", "2017-08-21").map(i =>
Tuple1(i.d))) {
implicit df =>
checkFilterPredicate('_1.isNull, classOf[Eq[_]], Seq.empty[Row])
checkFilterPredicate('_1.isNotNull, classOf[NotEq[_]],
Seq("2017-08-18", "2017-08-19", "2017-08-20",
"2017-08-21").map(i => Row.apply(i.d)))
checkFilterPredicate('_1 === "2017-08-18".d, classOf[Eq[_]],
"2017-08-18".d)
checkFilterPredicate('_1 =!= "2017-08-18".d, classOf[NotEq[_]],
Seq("2017-08-19", "2017-08-20", "2017-08-21").map(i =>
Row.apply(i.d)))
```
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]