You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Matthew Sinton-Hewitt (JIRA)" <ji...@apache.org> on 2017/10/26 14:06:01 UTC

[jira] [Created] (SPARK-22364) unix_timestamp function sets valid dates to null

Matthew Sinton-Hewitt created SPARK-22364:
---------------------------------------------

             Summary: unix_timestamp function sets valid dates to null
                 Key: SPARK-22364
                 URL: https://issues.apache.org/jira/browse/SPARK-22364
             Project: Spark
          Issue Type: Bug
          Components: SQL
    Affects Versions: 2.2.0
         Environment: Windows 10, United Kingdom
            Reporter: Matthew Sinton-Hewitt


org.apache.spark.sql.functions.unix_timestamp sets some valid dates to null.

The dates happen to be the at the start of Daylight Savings time (UK and possibly elsewhere).

{code:scala}
import spark.implicits._

SparkSession.builder.getOrCreate()
.sparkContext.parallelize(
   Seq("25/03/2012 00:59", "25/03/2012 01:00", "25/03/2012 01:59", "25/03/2012 02:01"))
      .toDF("date")
      .select(unix_timestamp($"date", "dd/MM/yyyy HH:mm"))
      .show(false)

// results:
// 1332637140, null, null, 1332637260
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

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