GitHub user dongjoon-hyun opened a pull request:
https://github.com/apache/spark/pull/14631
[SPARK-17035][SQL][PYSPARK] Timestamp should preserve microseconds part
## What changes were proposed in this pull request?
**Before**
```
>>> from datetime import datetime
>>> from pyspark.sql import Row
>>> from pyspark.sql.types import StructType, StructField, TimestampType
>>> schema = StructType([StructField("dt", TimestampType(), False)])
>>> data = [{"dt": datetime.max}]
>>> sql_data = [schema.toInternal(row) for row in data]
>>> sql_data
[(253402329600000000,)]
```
**After**
```
>>> from datetime import datetime
>>> from pyspark.sql import Row
>>> from pyspark.sql.types import StructType, StructField, TimestampType
>>> schema = StructType([StructField("dt", TimestampType(), False)])
>>> data = [{"dt": datetime.max}]
>>> sql_data = [schema.toInternal(row) for row in data]
>>> sql_data
[(253402329599999999,)]
```
## How was this patch tested?
Pass the Jenkins test with a new test case.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/dongjoon-hyun/spark SPARK-17035
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/14631.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 #14631
----
commit 962a052fcb76ed364b77cb328d5bd9b2a5c83775
Author: Dongjoon Hyun <[email protected]>
Date: 2016-08-13T21:35:32Z
[SPARK-17035][SQL][PYSPARK] Timestamp should not lost microseconds part
----
---
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]