-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31489][SQL] Fix pushing down filters with java.time.LocalDate values in ORC
#28261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
71bb4cb
cde48ee
392c0e6
ae18964
e5952e1
aa57be0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ package org.apache.spark.sql.execution.datasources.orc | |
| import java.math.MathContext | ||
| import java.nio.charset.StandardCharsets | ||
| import java.sql.{Date, Timestamp} | ||
| import java.time.LocalDate | ||
|
|
||
| import scala.collection.JavaConverters._ | ||
|
|
||
|
|
@@ -451,5 +452,31 @@ class OrcFilterSuite extends OrcTest with SharedSparkSession { | |
| ).get.toString | ||
| } | ||
| } | ||
|
|
||
| test("filter pushdown - local date") { | ||
| val dates = Seq("2017-08-18", "2017-08-19", "2017-08-20", "2017-08-21").map { day => | ||
| LocalDate.parse(day) | ||
| } | ||
| withSQLConf(SQLConf.DATETIME_JAVA8API_ENABLED.key -> "true") { | ||
|
||
| withOrcDataFrame(dates.map(Tuple1(_))) { implicit df => | ||
| checkFilterPredicate($"_1".isNull, PredicateLeaf.Operator.IS_NULL) | ||
|
|
||
| checkFilterPredicate($"_1" === dates(0), PredicateLeaf.Operator.EQUALS) | ||
| checkFilterPredicate($"_1" <=> dates(0), PredicateLeaf.Operator.NULL_SAFE_EQUALS) | ||
|
|
||
| checkFilterPredicate($"_1" < dates(1), PredicateLeaf.Operator.LESS_THAN) | ||
| checkFilterPredicate($"_1" > dates(2), PredicateLeaf.Operator.LESS_THAN_EQUALS) | ||
| checkFilterPredicate($"_1" <= dates(0), PredicateLeaf.Operator.LESS_THAN_EQUALS) | ||
| checkFilterPredicate($"_1" >= dates(3), PredicateLeaf.Operator.LESS_THAN) | ||
|
|
||
| checkFilterPredicate(Literal(dates(0)) === $"_1", PredicateLeaf.Operator.EQUALS) | ||
| checkFilterPredicate(Literal(dates(0)) <=> $"_1", PredicateLeaf.Operator.NULL_SAFE_EQUALS) | ||
| checkFilterPredicate(Literal(dates(1)) > $"_1", PredicateLeaf.Operator.LESS_THAN) | ||
| checkFilterPredicate(Literal(dates(2)) < $"_1", PredicateLeaf.Operator.LESS_THAN_EQUALS) | ||
| checkFilterPredicate(Literal(dates(0)) >= $"_1", PredicateLeaf.Operator.LESS_THAN_EQUALS) | ||
| checkFilterPredicate(Literal(dates(3)) <= $"_1", PredicateLeaf.Operator.LESS_THAN) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit.
test("SPARK-31489: filter.