Github user dongjoon-hyun commented on a diff in the pull request:

    https://github.com/apache/spark/pull/22688#discussion_r224326576
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/sources/v2/DataSourceV2Suite.scala 
---
    @@ -351,6 +351,21 @@ class DataSourceV2Suite extends QueryTest with 
SharedSQLContext {
           }
         }
       }
    +
    +  test("SPARK-25700: do not read schema when writing in other modes except 
append mode") {
    +    withTempPath { file =>
    +      val cls = classOf[SimpleWriteOnlyDataSource]
    +      val path = file.getCanonicalPath
    +      val df = spark.range(5).select('id as 'i, -'id as 'j)
    +      try {
    +        df.write.format(cls.getName).option("path", 
path).mode("error").save()
    +        df.write.format(cls.getName).option("path", 
path).mode("overwrite").save()
    +        df.write.format(cls.getName).option("path", 
path).mode("ignore").save()
    +      } catch {
    +        case e: SchemaReadAttemptException => fail("Schema read was 
attempted.", e)
    +      }
    --- End diff --
    
    To validate new code path [line 
250](https://github.com/apache/spark/pull/22688/files#diff-94fbd986b04087223f53697d4b6cab24R250),
 could you add `intercept[SchemaReadAttemptException]` and do `append`, too?


---

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

Reply via email to