Skip to content

Commit

Permalink
Java8 time objects support
Browse files Browse the repository at this point in the history
  • Loading branch information
yhosny committed Mar 14, 2024
1 parent 9a59c0a commit 171ba83
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ object DeltaSourceUtils {
case v: Boolean => expressions.Literal.create(v)
case v: java.sql.Date => expressions.Literal.create(v)
case v: java.sql.Timestamp => expressions.Literal.create(v)
case v: java.time.LocalDate => expressions.Literal.create(v)
case v: java.time.LocalDateTime => expressions.Literal.create(v)
case v: BigDecimal => expressions.Literal.create(v)
}

Expand Down
14 changes: 14 additions & 0 deletions spark/src/test/scala/org/apache/spark/sql/delta/DeltaSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,20 @@ class DeltaSuite extends QueryTest
}
}

test("support Java8 time objects") {
withSQLConf(SQLConf.DATETIME_JAVA8API_ENABLED.key -> "true") {
val tableName = "my_table"
withTable(tableName) {
spark.sql(s"CREATE TABLE $tableName (id STRING, date DATE) USING DELTA;")
spark.sql(
s"""
|INSERT INTO $tableName REPLACE
|where (DATE IN (DATE('2024-03-11'), DATE('2024-03-13')))
|VALUES ('2', DATE('2024-03-13')), ('3', DATE('2024-03-11'))
|""".stripMargin)
}
}
}

test("all operations with special characters in path") {
withTempDir { dir =>
Expand Down

0 comments on commit 171ba83

Please sign in to comment.