-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Support Java8 time objects #2752
Conversation
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.
test cannot have the same name
spark/src/test/scala/org/apache/spark/sql/delta/DeltaSuite.scala
Outdated
Show resolved
Hide resolved
spark/src/test/scala/org/apache/spark/sql/delta/DeltaSuite.scala
Outdated
Show resolved
Hide resolved
@@ -1607,6 +1607,37 @@ class DeltaSuite extends QueryTest | |||
} | |||
} | |||
|
|||
test("support Java8 time object") { | |||
withSQLConf(SQLConf.DATETIME_JAVA8API_ENABLED.key -> "true") { |
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.
can you give me a reference for this in Spark code? I want to understand how this is tested in Spark.
Co-authored-by: Sandip Agarwala <[email protected]>
Co-authored-by: Sandip Agarwala <[email protected]>
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.
I would like to see a bit more information about the Java8 APIs from the Spark stuff before expanding public API support.
I dont agree with your description that this does not change public API completely. Its quite possible that this SQL conf will be enable in Spark by default. That would implicitly allow new SQL operations in Delta that would have failed earlier. So I do want to understand the public API surface area before I approve this.
Summarizing offline conversation:
|
Which Delta project/connector is this regarding?
Description
Added support for Java8 time objects when Java8Api is enabled.
The following query fails when Java8Api is enabled:
How was this patch tested?
Unit Test.
Does this PR introduce any user-facing changes?
The potential public surface area for this change is limited to only external DateType, TimestampType. By default, Spark converts DateType values to java.sql.Date, TimestampType -> java.sql.Timestamp but with the SQL conf enabled, Spark uses java.time.LocalDate as the external type for DateType and java.time.Instant for TimestampType.
Necessity of fix: If users use Spark 3.0 and enable Java 8, they will be unable to parse and use dates in Delta tables correctly, leading to matching errors.