[
https://issues.apache.org/jira/browse/SPARK-51556?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Max Gekk reassigned SPARK-51556:
--------------------------------
Assignee: (was: Max Gekk)
> 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
> Priority: Major
>
> 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: [email protected]
For additional commands, e-mail: [email protected]