Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.3.0
-
None
Description
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
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.
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
Attachments
Issue Links
- is a parent of
-
SPARK-38535 Add the datetimeUnit enum to the grammar and use it in TIMESTAMPADD/DIFF
- Resolved
- links to