gengliangwang commented on a change in pull request #29162:
URL: https://github.com/apache/spark/pull/29162#discussion_r457199982



##########
File path: docs/sql-migration-guide.md
##########
@@ -148,7 +148,8 @@ license: |
 
   - In Spark 3.0, Proleptic Gregorian calendar is used in parsing, formatting, 
and converting dates and timestamps as well as in extracting sub-components 
like years, days and so on. Spark 3.0 uses Java 8 API classes from the 
`java.time` packages that are based on [ISO 
chronology](https://docs.oracle.com/javase/8/docs/api/java/time/chrono/IsoChronology.html).
 In Spark version 2.4 and below, those operations are performed using the 
hybrid calendar ([Julian + 
Gregorian](https://docs.oracle.com/javase/7/docs/api/java/util/GregorianCalendar.html).
 The changes impact on the results for dates before October 15, 1582 
(Gregorian) and affect on the following Spark 3.0 API:
 
-    * Parsing/formatting of timestamp/date strings. This effects on CSV/JSON 
datasources and on the `unix_timestamp`, `date_format`, `to_unix_timestamp`, 
`from_unixtime`, `to_date`, `to_timestamp` functions when patterns specified by 
users is used for parsing and formatting. In Spark 3.0, we define our own 
pattern strings in `sql-ref-datetime-pattern.md`, which is implemented via 
`java.time.format.DateTimeFormatter` under the hood. New implementation 
performs strict checking of its input. For example, the `2015-07-22 10:00:00` 
timestamp cannot be parse if pattern is `yyyy-MM-dd` because the parser does 
not consume whole input. Another example is the `31/01/2015 00:00` input cannot 
be parsed by the `dd/MM/yyyy hh:mm` pattern because `hh` supposes hours in the 
range `1-12`. In Spark version 2.4 and below, `java.text.SimpleDateFormat` is 
used for timestamp/date string conversions, and the supported patterns are 
described in [simpleDateFormat](https://docs.oracle.com/javase/7/docs/api/j
 ava/text/SimpleDateFormat.html). The old behavior can be restored by setting 
`spark.sql.legacy.timeParserPolicy` to `LEGACY`.
+    * Parsing/formatting of timestamp/date strings. This effects on CSV/JSON 
datasources and on the `unix_timestamp`, `date_format`, `to_unix_timestamp`, 
`from_unixtime`, `to_date`, `to_timestamp` functions when patterns specified by 
users is used for parsing and formatting. In Spark 3.0, we define our own 
pattern strings in [Datetime Patterns for Formatting and 
Parsing](sql-ref-datetime-pattern.html),
+     which is implemented via `java.time.format.DateTimeFormatter` under the 
hood. New implementation performs strict checking of its input. For example, 
the `2015-07-22 10:00:00` timestamp cannot be parse if pattern is `yyyy-MM-dd` 
because the parser does not consume whole input. Another example is the 
`31/01/2015 00:00` input cannot be parsed by the `dd/MM/yyyy hh:mm` pattern 
because `hh` supposes hours in the range `1-12`. In Spark version 2.4 and 
below, `java.text.SimpleDateFormat` is used for timestamp/date string 
conversions, and the supported patterns are described in 
[simpleDateFormat](https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html).
 The old behavior can be restored by setting 
`spark.sql.legacy.timeParserPolicy` to `LEGACY`.

Review comment:
       Thanks, I have updated the doc according to your comments.




----------------------------------------------------------------
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]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to