Github user ueshin commented on a diff in the pull request:

    https://github.com/apache/spark/pull/16750#discussion_r100729866
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JSONOptions.scala
 ---
    @@ -58,13 +59,15 @@ private[sql] class JSONOptions(
       private val parseMode = parameters.getOrElse("mode", "PERMISSIVE")
       val columnNameOfCorruptRecord = 
parameters.get("columnNameOfCorruptRecord")
     
    +  val timeZone: TimeZone = 
TimeZone.getTimeZone(parameters.getOrElse("timeZone", defaultTimeZoneId))
    +
       // Uses `FastDateFormat` which can be direct replacement for 
`SimpleDateFormat` and thread-safe.
       val dateFormat: FastDateFormat =
         FastDateFormat.getInstance(parameters.getOrElse("dateFormat", 
"yyyy-MM-dd"), Locale.US)
    --- End diff --
    
    That is a combination of the `dateFormat` and 
`DateTimeUtils.millisToDays()` (see 
[JacksonParser.scala#L251](https://github.com/ueshin/apache-spark/blob/ffc4912e17cc900fc9d7ceefd0f66461109728e9/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/json/JacksonParser.scala#L251)
 or 
[UnivocityParser.scala#L137](https://github.com/ueshin/apache-spark/blob/ffc4912e17cc900fc9d7ceefd0f66461109728e9/sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/csv/UnivocityParser.scala#L137)).
    
    If both timezones of the `dateFormat` and `DateTimeUtils.millisToDays()` 
are the same, the days will be calculated correctly.
    Here the `dateFormat` will have the default timezone to parse and 
`DateTimeUtils.millisToDays()` will also use the default timezone to calculate 
days here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to