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

    https://github.com/apache/spark/pull/17177#discussion_r104436338
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/csv/CSVSuite.scala
 ---
    @@ -465,6 +465,47 @@ class CSVSuite extends QueryTest with SharedSQLContext 
with SQLTestUtils {
         }
       }
     
    +  test("save csv with quote escaping enabled, avoiding double backslash") {
    +    withTempDir { dir =>
    +      val csvDir = new File(dir, "csv").getCanonicalPath
    +
    +      val df1 = spark.sqlContext.createDataFrame(List(
    +        (1, "aa\\\"bb,cc"),         // aa\"bb,cc
    +        (2, "aa\\\\\"bb,cc"),       // aa\\\"bb,cc
    +        (3, "aa\\\"\\\"bb,cc"),     // aa\"\"bb,cc
    +        (4, "aa\\\\\"\\\\\"bb,cc")  // aa\\\"\\\"bb,cc
    +      ))
    +
    +      df1.coalesce(1).write
    +              .format("csv")
    +              .option("quote", "\"")
    +              .option("escape", "\\")
    +              .save(csvDir)
    +
    +      val df2 = spark.read.csv(csvDir).orderBy($"_c0")
    +
    +      val df1Str = df1.collect().map(_.getString(1)).mkString(" ")
    +
    +      val df2Str = 
df2.select("_c1").collect().map(_.getString(0)).mkString(" ")
    +
    +      val text = spark.read
    --- End diff --
    
    We should double-spaced line indentation. (please refer 
https://github.com/databricks/scala-style-guide)


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