You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Senthil Kumar (Jira)" <ji...@apache.org> on 2025/03/20 05:50:00 UTC
[jira] [Commented] (SPARK-51555) Add the timediff() function
[ https://issues.apache.org/jira/browse/SPARK-51555?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17937009#comment-17937009 ]
Senthil Kumar commented on SPARK-51555:
---------------------------------------
[~maxgekk] I am working on this along with Hour functionality
> 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-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org