[ 
https://issues.apache.org/jira/browse/SPARK-51456?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated SPARK-51456:
-----------------------------------
    Labels: pull-request-available  (was: )

> Add the to_time() function
> --------------------------
>
>                 Key: SPARK-51456
>                 URL: https://issues.apache.org/jira/browse/SPARK-51456
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 4.1.0
>            Reporter: Max Gekk
>            Assignee: Max Gekk
>            Priority: Major
>              Labels: pull-request-available
>
> The new function *to_time()* should return expr cast to a timestamp using an 
> optional formatting.
> h4. Syntax
> {code:sql}
> to_time(expr [, fmt] )
> {code}
> h4. Arguments
> * expr: A STRING expression representing a time.
> * fmt: An optional format STRING expression.
> h4. Returns
> h4. A TIME\(n\). If n where n is derived from fmt.
> If fmt is supplied, it must conform with Datetime patterns.
> If fmt is not supplied, the function is a synonym for cast(expr AS TIME).
> If fmt is malformed or its application does not result in a well formed time, 
> the function raises an error.
> To return NULL instead of an error in case of a malformed expr use 
> try_to_time.
> h4. Examples
> {code:sql}
> > SELECT to_time('00:12:00');
>  00:12:00
> > SELECT to_time('12.10.05', 'hh.mm.ss');
>  12:10:05
> {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