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

Senthil Kumar commented on SPARK-51555:
---------------------------------------

[~maxgekk] We do not have functions for MICROSECOND and MILLISECOND. So my 
understanding is that we need to have separate functions for MILLISECOND and 
MICROSECOND ,similar SPARK-51419, SPARK-51420, to before implementing 
"timeDiff". 

Please let me know if my understanding is correct

> 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
>            Priority: Major
>
> 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: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to