Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17177#discussion_r105306510
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala
 ---
    @@ -465,6 +465,44 @@ class CSVSuite extends QueryTest with SharedSQLContext 
with SQLTestUtils {
         }
       }
     
    +  test("save csv with quote escaping enabled, using char to escape 
quote-escape") {
    +    withTempDir { dir =>
    +      val csvDir = new File(dir, "csv").getCanonicalPath
    +
    +
    +      val df1 = spark.sqlContext.createDataFrame(List(
    +        (1, """AA\"BB"""),              // 1 escape char anc 1 quote char
    +        (2, """AA\\"BB"""),             // 2 escape char and 1 quote char
    +        (3, """AA\"\"\"\"\"BB"""),      // (1 escape char anc 1 quote 
char) * 5
    +        (4, """AA\\"\\"\\"\\"\\"BB"""), // (2 escape char and 1 quote 
char) * 5
    +        (5, """You are "beautiful"""),
    +        (6, """Yes, \"inside"\""")
    +      ))
    +
    +      // escapeQuotes should be true by default
    +      // escapeEscape should be equal to quote by default
    +      df1.coalesce(1).write
    +        .format("csv")
    +        .option("quote", "\"")
    +        .option("escape", "\\")
    +        .option("escapeEscape", "\"")
    +        .save(csvDir)
    +
    +      val df2 = spark.read
    +        .format("csv")
    +        .option("quote", "\"")
    +        .option("escape", "\\")
    +        .option("escapeEscape", "\"")
    +        .load(csvDir).orderBy($"_c0")
    +
    +      val df1Str = df1.collect().map(_.getString(1)).mkString("")
    +      val df2Str = df2.collect().map(_.getString(1)).mkString("")
    +
    +      assert(df1Str == df2Str)
    +    }
    +  }
    +
    +
    --- End diff --
    
    super minor: single newline :).


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to