Description
Switch to Java 8 time API by turning on the SQL config spark.sql.datetime.java8API.enabled to address the following issues:
- Date and timestamp string literals are parsed by using Java 8 time API and Spark's session time zone. Before the changes, date/timestamp values were collected as legacy types `java.sql.Date`/`java.sql.Timestamp`, and the value of such types didn't respect the config `spark.sql.session.timeZone`. To have consistent view, users had to keep JVM time zone and Spark's session time zone in sync.
- After the changes, formatting of date values doesn't depend on JVM time zone.
- While returning dates/timestamps of Java 8 type, we can avoid dates/timestamps rebasing from Proleptic Gregorian calendar to the hybrid calendar (Julian + Gregorian), and the issues related to calendar switching.
- Properly handle negative years (BCE).
- Consistent conversion of date/timestamp strings to/from internal Catalyst types in both direction to and from Spark.