Max Gekk created SPARK-51555:
--------------------------------

             Summary: Add the timediff() function
                 Key: SPARK-51555
                 URL: https://issues.apache.org/jira/browse/SPARK-51555
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 4.1.0
            Reporter: Max Gekk


Add the timediff function which returns the difference between two times 
measured in units.

h4. Syntax

{code}
timediff(unit, start, end)

unit
 { MICROSECOND |
   MILLISECOND |
   SECOND |
   MINUTE |
   HOUR }
{code}

h4. Arguments
* unit: A unit of measure.
* start: A starting TIME expression.
* end: An ending TIME expression.

h4. Returns
A INTEGER.
If start is greater than end the result is negative.

h4. Examples

{code:sql}
> SELECT timediff(HOUR, TIME'20:30:29', '21:30:28');
 0

> SELECT timediff(HOUR, TIME'20:30:29', '21:30:29');
 1

> SELECT timediff(HOUR, TIME'20:30:29', '12:00:00');
 -8
{code}








--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to