You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2025/04/16 11:01:00 UTC
[jira] [Updated] (SPARK-51554) Add the time_trunc() function
[ https://issues.apache.org/jira/browse/SPARK-51554?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated SPARK-51554:
-----------------------------------
Labels: pull-request-available (was: )
> Add the time_trunc() function
> -----------------------------
>
> Key: SPARK-51554
> URL: https://issues.apache.org/jira/browse/SPARK-51554
> Project: Spark
> Issue Type: Sub-task
> Components: SQL
> Affects Versions: 4.1.0
> Reporter: Max Gekk
> Priority: Major
> Labels: pull-request-available
>
> The time_trunc() function returns time truncated to the unit specified in unit.
> h4. Syntax
> {code:sql}
> time_trunc(unit, expr)
> {code}
> h4. Arguments
> * unit: A STRING literal.
> * expr: A TIME, or STRING with a valid time format.
> h4.
> A TIME\(n\) with n matching that of expr.
> h4. Notes
> Valid units for unit are (case-insensitive):
> * 'HOUR': zero out the minute and second with fraction part
> * 'MINUTE': zero out the second with fraction part
> * 'SECOND': zero out the second fraction part
> * 'MILLISECOND': zero out the microseconds
> * 'MICROSECOND': everything remains
> If the unit is not well-formed the function returns NULL.
> h4. Examples
> {code:sql}
> > SELECT time_trunc('HOUR', '09:32:05.359');
> 09:00:00
> > SELECT time_trunc('MILLISECOND', '09:32:05.123456');
> 09:32:05.123
> -- Not a recognised unit
> > SELECT time_trunc('MS', '09:32:05.123456');
> NULL
> {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