spark-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Oksana Romankova (JIRA)" <j...@apache.org>
Subject [jira] [Created] (SPARK-17914) Spark SQL casting to TimestampType with nanosecond results in incorrect timestamp
Date Thu, 13 Oct 2016 17:36:20 GMT
Oksana Romankova created SPARK-17914:
----------------------------------------

             Summary: Spark SQL casting to TimestampType with nanosecond results in incorrect
timestamp
                 Key: SPARK-17914
                 URL: https://issues.apache.org/jira/browse/SPARK-17914
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 1.6.1
            Reporter: Oksana Romankova


In some cases when timestamps contain nanoseconds they will be parsed incorrectly. 

Examples: 

"2016-05-14T15:12:14.0034567Z" -> "2016-05-14 15:12:14.034567"
"2016-05-14T15:12:14.000345678Z" -> "2016-05-14 15:12:14.345678"

The issue seems to be happening in DateTimeUtils.stringToTimestamp(). It assumes that only
6 digit fraction of a second will be passed.

With this being the case I would suggest either discarding nanoseconds automatically, or throw
an exception prompting to pre-format timestamps to microsecond precision first before casting
to the Timestamp.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org


Mime
View raw message