Chris Bedford created SPARK-28633:
-------------------------------------

             Summary: 
<dataframe>.write.option("mode","overwrite").saveAsTable("foo") fails with 
'already exists' if table foo exists      
                 Key: SPARK-28633
                 URL: https://issues.apache.org/jira/browse/SPARK-28633
             Project: Spark
          Issue Type: Bug
          Components: Spark Core
    Affects Versions: 2.4.3
            Reporter: Chris Bedford


I am guessing the bug title will be sufficient explanation of the issue.

below is a little script to illustrate. Running the script gives this error:

 > org.apache.spark.sql.AnalysisException: Table `example` already exists.;


 spark.sql("drop table if exists example ").show()
 case class Person(first: String, last: String, age: Integer)
 val df = List(
 Person("joe", "x", 9),
 Person("fred", "z", 9)).toDF()
 df.write.option("mode","overwrite").saveAsTable("example")

val recover1 = spark.read.table("example")
 recover1.show()


 val df3 = List(
 Person("mouse", "x", 9),
 Person("golf", "z", 9)).toDF()

df3.write.option("mode","overwrite").saveAsTable("example")

val recover4 = spark.read.table("example")
 recover4.show()

 



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

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

Reply via email to