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

Gengliang Wang updated SPARK-34881:
-----------------------------------
        Parent: SPARK-35161
    Issue Type: Sub-task  (was: New Feature)

> New SQL Function: TRY_CAST
> --------------------------
>
>                 Key: SPARK-34881
>                 URL: https://issues.apache.org/jira/browse/SPARK-34881
>             Project: Spark
>          Issue Type: Sub-task
>          Components: SQL
>    Affects Versions: 3.2.0
>            Reporter: Gengliang Wang
>            Assignee: Gengliang Wang
>            Priority: Major
>             Fix For: 3.2.0
>
>
> Add a new SQL function try_cast. try_cast is identical to CAST with 
> `spark.sql.ansi.enabled` as true, except it returns NULL instead of raising 
> an error. This expression has one major difference from `cast` with 
> `spark.sql.ansi.enabled` as true: when the source value can't be stored in 
> the target integral(Byte/Short/Int/Long) type, `try_cast` returns null 
> instead of returning the low order bytes of the source value.
> This is learned from Google BigQuery and Snowflake:
> https://docs.snowflake.com/en/sql-reference/functions/try_cast.html
> https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#safe_casting



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to