Gengliang Wang created SPARK-47696:
--------------------------------------

             Summary: try_to_timestamp should handle SparkUpgradeException
                 Key: SPARK-47696
                 URL: https://issues.apache.org/jira/browse/SPARK-47696
             Project: Spark
          Issue Type: Sub-task
          Components: SQL
    Affects Versions: 4.0.0, 3.5.2, 3.4.3
            Reporter: Gengliang Wang
            Assignee: Gengliang Wang


Currently, try_to_timestamp will throw an exception on legacy timestamp input.
{code:java}
> SELECT try_to_timestamp('2016-12-1', 'yyyy-MM-dd')

org.apache.spark.SparkUpgradeException: 
[INCONSISTENT_BEHAVIOR_CROSS_VERSION.PARSE_DATETIME_BY_NEW_PARSER] You may get 
a different result due to the upgrading to Spark >= 3.0:
Fail to parse '2016-12-1' in the new parser.
You can set "spark.sql.legacy.timeParserPolicy" to "LEGACY" to restore the 
behavior before Spark 3.0, or set to "CORRECTED" and treat it as an invalid 
datetime string. SQLSTATE: 42K0B {code}
It should return null instead of error.



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