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

    https://github.com/apache/spark/pull/18356#discussion_r123165617
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/test/DataFrameReaderWriterSuite.scala
 ---
    @@ -678,4 +679,34 @@ class DataFrameReaderWriterSuite extends QueryTest 
with SharedSQLContext with Be
           assert(e.contains("User specified schema not supported with 
`table`"))
         }
       }
    +
    +  test("SPARK-21144 fails when data schema and partition schema have 
duplicate columns") {
    +    // Check CSV format
    +    Seq((true, ("a", "a")), (false, ("aA", "Aa"))).foreach { case 
(caseSensitive, (c0, c1)) =>
    +      withSQLConf(SQLConf.CASE_SENSITIVE.key -> caseSensitive.toString) {
    +        withTempDir { src =>
    +          Seq(1).toDF(c0).write.option("header", 
true).mode("overwrite").csv(s"$src/$c1=1")
    +          val e = intercept[AnalysisException] {
    +            spark.read.option("header", true).csv(src.toString)
    +          }
    +          assert(e.getMessage.contains("Found duplicate column(s) in the 
datasource: "))
    +        }
    +      }
    +    }
    +
    +    // Check JSON/Parquet format
    +    Seq("json", "parquet").foreach { case format =>
    +      Seq((true, ("a", "a")), (false, ("aA", "Aa"))).foreach { case 
(caseSensitive, (c0, c1)) =>
    +        withSQLConf(SQLConf.CASE_SENSITIVE.key -> caseSensitive.toString) {
    +          withTempDir { src =>
    +            
Seq(1).toDF(c0).write.format(format).mode("overwrite").save(s"$src/$c1=1")
    +            val e = intercept[AnalysisException] {
    +              spark.read.format(format).load(src.toString)
    +            }
    +            assert(e.getMessage.contains("Found duplicate column(s) in the 
datasource: "))
    --- End diff --
    
    ok, I'll add test cases in a new pr.


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