You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Ivan Sadikov (Jira)" <ji...@apache.org> on 2022/07/14 06:02:00 UTC

[jira] [Updated] (SPARK-39731) Correctness issue when parsing dates with yyyyMMdd format in CSV and JSON

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

Ivan Sadikov updated SPARK-39731:
---------------------------------
    Summary: Correctness issue when parsing dates with yyyyMMdd format in CSV and JSON  (was: Correctness issue when parsing dates with yyyyMMdd format in CSV)

> Correctness issue when parsing dates with yyyyMMdd format in CSV and JSON
> -------------------------------------------------------------------------
>
>                 Key: SPARK-39731
>                 URL: https://issues.apache.org/jira/browse/SPARK-39731
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 3.4.0
>            Reporter: Ivan Sadikov
>            Priority: Major
>
> In Spark 3.x, when reading CSV data like this:
> {code:java}
> name,mydate
> 1,2020011
> 2,20201203{code}
> and specifying date pattern as "yyyyMMdd", dates are not parsed correctly with CORRECTED time parser policy.
> For example,
> {code:java}
> val df = spark.read.schema("name string, mydate date").option("dateFormat", "yyyyMMdd").option("header", "true").csv("file:/tmp/test.csv")
> df.show(false){code}
> Returns:
> {code:java}
> +----+--------------+
> |name|mydate        |
> +----+--------------+
> |1   |+2020011-01-01|
> |2   |2020-12-03    |
> +----+--------------+ {code}
> and it used to return null instead of the invalid date in Spark 3.2 or below.
>  
> The issue appears to be caused by this PR: [https://github.com/apache/spark/pull/32959].
>  



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

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