You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Martin Tapp (JIRA)" <ji...@apache.org> on 2016/07/06 18:17:11 UTC

[jira] [Commented] (SPARK-16394) Timestamp conversion error in pyspark.sql.Row.asDict because of timezones

    [ https://issues.apache.org/jira/browse/SPARK-16394?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15364792#comment-15364792 ] 

Martin Tapp commented on SPARK-16394:
-------------------------------------

It seems the root problem is the conversion from spark's internal representation to a pyspark Row object that already causes the timezone conversion problem. Hence, the only fix we have for now is to cast the column to StringType.

> Timestamp conversion error in pyspark.sql.Row.asDict because of timezones
> -------------------------------------------------------------------------
>
>                 Key: SPARK-16394
>                 URL: https://issues.apache.org/jira/browse/SPARK-16394
>             Project: Spark
>          Issue Type: Bug
>          Components: PySpark
>    Affects Versions: 1.6.1
>            Reporter: Martin Tapp
>            Priority: Minor
>
> We use DataFrame.map to convert each row to a dictionary using Row.asDict(). The problem occurs when a Timestamp column is converted. It seems the Timestamp gets converted to a naive Python datetime. This causes processing errors since all naive datetimes get adjusted to the process' timezone. For instance, a Timestamp with a time of midnight see's it's time bounce based on the local timezone (+/- x hours).
> Current fix is to apply the pytz.utc timezone to each datetime instance.
> Proposed solution is to make all datetime instances aware and use the pytz.utc timezone.



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