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

    https://github.com/apache/spark/pull/12872#discussion_r61987856
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/views.scala ---
    @@ -71,27 +81,69 @@ case class CreateViewCommand(
         require(tableDesc.schema == Nil || tableDesc.schema.length == 
analyzedPlan.output.length)
         val sessionState = sparkSession.sessionState
     
    -    if (sessionState.catalog.tableExists(tableIdentifier)) {
    +    if (isTemporary) {
    +      createTemporaryView(tableDesc.identifier, sparkSession, analyzedPlan)
    +    } else {
    +      // Adds default database for permanent table if it doesn't exist, so 
that tableExists()
    +      // only check permanent tables.
    +      val database = tableDesc.identifier.database.getOrElse(
    +        sessionState.catalog.getCurrentDatabase)
    +      val tableIdentifier = tableDesc.identifier.copy(database = 
Option(database))
    +
    +      if (sessionState.catalog.tableExists(tableIdentifier)) {
    +        if (allowExisting) {
    --- End diff --
    
    Fixed by disallowing "IF NOT EXISTS" syntax to be consistent with "CREATE 
TEMPORARY TABLE" behavior.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to