cloud-fan commented on a change in pull request #24161: [SPARK-27222][SQL]
Support Instant and LocalDate in Literal.apply
URL: https://github.com/apache/spark/pull/24161#discussion_r267933517
##########
File path:
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/LiteralExpressionSuite.scala
##########
@@ -228,4 +236,47 @@ class LiteralExpressionSuite extends SparkFunSuite with
ExpressionEvalHelper {
checkEvaluation(Literal('\u0000'), "\u0000")
checkEvaluation(Literal.create('\n'), "\n")
}
+
+ test("construct literals from java.time.LocalDate") {
+ Seq(
+ LocalDate.of(1, 1, 1),
+ LocalDate.of(1582, 10, 1),
+ LocalDate.of(1600, 7, 30),
+ LocalDate.of(1969, 12, 31),
+ LocalDate.of(1970, 1, 1),
+ LocalDate.of(2019, 3, 20),
+ LocalDate.of(2100, 5, 17)).foreach { localDate =>
+ checkEvaluation(Literal(localDate), localDate)
+ }
+ }
+
+ test("construct literals from arrays of java.time.LocalDate") {
+ withSQLConf(SQLConf.DATETIME_JAVA8API_EANBLED.key -> "true") {
Review comment:
not a big idea, but the behavior of literal is not controlled by this config
right?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]