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

Max Gekk resolved SPARK-51556.
------------------------------
    Fix Version/s: 4.1.0
       Resolution: Fixed

Issue resolved by pull request 50335
[https://github.com/apache/spark/pull/50335]

> Add the try_to_time() function
> ------------------------------
>
>                 Key: SPARK-51556
>                 URL: https://issues.apache.org/jira/browse/SPARK-51556
>             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, starter
>             Fix For: 4.1.0
>
>
> Add the try_to_time() function which returns expr cast to a time using an 
> optional formatting.
> h4. Syntax
> {code}
> try_to_time(expr [, fmt])
> {code}
> h4. Arguments
> * expr: A STRING expression representing a time.
> * fmt: An optional format STRING expression.
> h4. Returns
> 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 returns NULL.
> To return an error instead of NULL in case of a malformed expr use to_time.
> h4. Examples
> {code:sql}
> > SELECT try_to_time('00:12:00');
>  00:12:00
> > SELECT try_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