GitHub user HyukjinKwon opened a pull request:

    https://github.com/apache/spark/pull/14829

    [SPARK-16216][SQL][FOLLOWUP] Enable JSON types for timestamp and clean up 
writing logics

    ## What changes were proposed in this pull request?
    
    This PR enables the tests for `TimestampType` for JSON and unifies the 
logics for verifying schema when writing in CSV. 
    
    In more details, this PR includes:
    
    - Enables the tests for `TimestampType` for JSON and
    
      This was disabled due to an issue in `DatatypeConverter.parseDateTime` 
which parses dates incorrectly, for example as below:
    
      ```scala
       val d = 
javax.xml.bind.DatatypeConverter.parseDateTime("0900-01-01T00:00:00.000").getTime
      println(d.toString)
      ```
      ```
      Fri Dec 28 00:00:00 KST 899
      ```
    
      However, since we use `FastDateFormat`, it seems we are safe now.
    
      ```scala
      val d = 
FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSS").parse("0900-01-01T00:00:00.000")
      println(d)
      ```
      ```
      Tue Jan 01 00:00:00 PST 900
      ```
    
    - Unifies the logics for verifying schema when writing in CSV. 
    
      There is a separate logics to verify the schemas in `CSVFileFormat`. This 
is actually not quite correct enough because we don't support `NullType` and 
`CalanderIntervalType` as well `StructType`, `ArrayType`, `MapType`. So, this 
PR moves the logics into values writer just like JSON data source so that we 
can make sure of supported types and unsupported types.
    
    ## How was this patch tested?
    
    Tests in `JsonHadoopFsRelation` and `CSVSuite`


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/HyukjinKwon/spark SPARK-16216-followup

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/14829.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #14829
    
----
commit 2f10a99ab97effd924b4d4da7cc039571ae19bf8
Author: hyukjinkwon <[email protected]>
Date:   2016-08-26T11:03:43Z

    Clean up CSV and enable JSON types for timestamp

commit 0f831279293e4267a0e19221a66c5969f29307bb
Author: hyukjinkwon <[email protected]>
Date:   2016-08-26T11:08:56Z

    Add mistakenly removed case

----


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