Github user HyukjinKwon commented on the issue:

    https://github.com/apache/spark/pull/18200
  
    @maropu and @gatorsmile, I double-checked
    
    ```
    --- a/sql/core/pom.xml
    +++ b/sql/core/pom.xml
    @@ -38,7 +38,7 @@
         <dependency>
           <groupId>com.univocity</groupId>
           <artifactId>univocity-parsers</artifactId>
    -      <version>2.2.1</version>
    +      <version>2.5.0-SNAPSHOT</version>
           <type>jar</type>
         </dependency>
         <dependency>
    ```
    
    it is fixed in `2.5.0-SNAPSHOT` and other tests pass fine.
    
    ```scala
    val df = spark.read
      .schema("a string, b string, unparsed string")
      .option("columnNameOfCorruptRecord", "unparsed")
      .csv(Seq("a").toDS())
    df.show()
    ```
    
    ```
    +---+----+--------+
    |  a|   b|unparsed|
    +---+----+--------+
    |  a|null|       a|
    +---+----+--------+
    ```
    
    ```scala
    val corruptCVSRecords: Dataset[String] =
      spark.createDataset(spark.sparkContext.parallelize(
        """1, "b"""" ::
        """2""" :: Nil))(Encoders.STRING)
    
    val df1 = spark.read
      .schema("col1 int, col2 String, __corrupted_column_name string")
      .option("columnNameOfCorruptRecord", "__corrupted_column_name")
      .option("mode", PermissiveMode.name)
      .csv(corruptCVSRecords)
    df1.show()
    ```
    
    ```
    +----+----+-----------------------+
    |col1|col2|__corrupted_column_name|
    +----+----+-----------------------+
    |   1| "b"|                   null|
    |   2|null|                      2|
    +----+----+-----------------------+
    ```
    
    Thank you for checking this. I will double check and will propose to bump 
up this library after the release.



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to