sadikovi opened a new pull request #34638:
URL: https://github.com/apache/spark/pull/34638


   ### What changes were proposed in this pull request?
   
   This PR adds support for TimestampNTZ type in the JSON data source. 
   
   Most of the functionality has already been added, this patch verifies that 
writes + reads work for TimestampNTZ type and adds schema inference depending 
on the timestamp value format written. The following applies:
   - If there is a mixture of `TIMESTAMP_NTZ` and `TIMESTAMP_LTZ` values, use 
`TIMESTAMP_LTZ`.
   - If there are only `TIMESTAMP_NTZ` values, resolve using the the default 
timestamp type configured with `spark.sql.timestampType`.
   
   In addition, I introduced a new JSON option `timestampNTZFormat` which is 
similar to `timestampFormat` but it allows to configure read/write pattern for 
`TIMESTAMP_NTZ` types. It is basically a copy of timestamp pattern but without 
timezone.
   
   ### Why are the changes needed?
   
   The PR fixes issues when writing and reading TimestampNTZ to and from JSON.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Previously, JSON data source would infer timestamp values as `TimestampType` 
when reading a JSON file. Now, the data source would infer the timestamp value 
type based on the format (with or without timezone) and default timestamp type 
based on `spark.sql.timestampType`.
   
   A new JSON option `timestampNTZFormat` is added to control the way values 
are formatted during writes or parsed during reads.
   
   ### How was this patch tested?
   
   I extended `JsonSuite` with a few unit tests to verify that write-read 
roundtrip works for `TIMESTAMP_NTZ` and `TIMESTAMP_LTZ` values.
   


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

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to