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

    https://github.com/apache/spark/pull/4446#discussion_r24467856
  
    --- Diff: 
sql/hive/src/main/scala/org/apache/spark/sql/hive/execution/commands.scala ---
    @@ -166,15 +160,82 @@ case class CreateMetastoreDataSourceAsSelect(
             options
           }
     
    -    // Create the relation based on the data of df.
    -    ResolvedDataSource(sqlContext, provider, optionsWithPath, df)
    +    if (sqlContext.catalog.tableExists(Seq(tableName))) {
    +      // Check if we need to throw an exception or just return.
    +      mode match {
    +        case SaveMode.ErrorIfExists =>
    +          sys.error(s"Table $tableName already exists. " +
    +            s"If you want to append into it, please set mode to 
SaveMode.Append. " +
    +            s"Or, if you want to overwrite it, please set mode to 
SaveMode.Overwrite.")
    --- End diff --
    
    this error is going to print even if its a SQL CTAS right?  that might be 
confusing.


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