pan3793 commented on code in PR #53129:
URL: https://github.com/apache/spark/pull/53129#discussion_r2548306006


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/catalog/GlobalTempViewManager.scala:
##########
@@ -55,9 +55,17 @@ class GlobalTempViewManager(database: String) {
   def create(
       name: String,
       viewDefinition: TemporaryViewRelation,
+      ignoreIfExists: Boolean,
       overrideIfExists: Boolean): Unit = synchronized {
-    if (!overrideIfExists && viewDefinitions.contains(name)) {
-      throw new TempTableAlreadyExistsException(name)
+    if (ignoreIfExists && overrideIfExists) {

Review Comment:
   @holdenk 
   
   - `overrideIfExists` SQL equivalent: `OR REPLACE`
   - `ignoreIfExists` SQL equivalent: `IF NOT EXISTS`
   
   ```
   CREATE [ OR REPLACE ] GLOBAL TEMP VIEW [ IF NOT EXISTS ] ...
   ```
   
   obviously, `OR REPLACE` and `IF NOT EXISTS` can not co-exist, except for 
this, all other combinations are valid.
   
   Snowflake has the same behavior
   
   
https://docs.snowflake.com/en/sql-reference/sql/create-view#general-usage-notes
   
   > The OR REPLACE and IF NOT EXISTS clauses are mutually exclusive. They 
can’t both be used in the same statement.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to