[ 
https://issues.apache.org/jira/browse/SPARK-38284?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Apache Spark reassigned SPARK-38284:
------------------------------------

    Assignee: Max Gekk  (was: Apache Spark)

> Add the TIMESTAMPDIFF() function
> --------------------------------
>
>                 Key: SPARK-38284
>                 URL: https://issues.apache.org/jira/browse/SPARK-38284
>             Project: Spark
>          Issue Type: New Feature
>          Components: SQL
>    Affects Versions: 3.3.0
>            Reporter: Max Gekk
>            Assignee: Max Gekk
>            Priority: Major
>
> Two functions that are part of the ODBC api and implemented virtually by ALL 
> other databases are missing in Spark SQL.
> TIMESTAMPADD() and TIMESTAMPDIFF()
> See
> * [Time, Date, and Interval 
> Functions|https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/time-date-and-interval-functions?view=sql-server-ver15]
> * [TIMESTAMPDIFF function (ODBC 
> compatible)|https://docs.faircom.com/doc/sqlref/33477.htm]
> The TIMESTAMPDIFF() function is also VERY convenient and would be a great 
> addition because getting the difference between two timestamps in seconds in 
> spark today requires converting to unixtimestamp and back.
> {code:sql}
> SELECT TIMESTAMPDIFF(SECOND, '2021-12-30 01:02:00':timestamp,  '2021-12-30 
> 01:00:00':timestamp)
> >120
> -- Current Support
> SELECT unix_timestamp('2021-12-30 01:00:00':timestamp) - 
> unix_timestamp('2021-12-30 01:00:00':timestamp)
> > 120
> {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

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

Reply via email to