Max Gekk created SPARK-51556:
--------------------------------

             Summary: 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


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.





--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to