rdblue commented on a change in pull request #24798: [SPARK-27724][SQL] 
Implement REPLACE TABLE and REPLACE TABLE AS SELECT with V2
URL: https://github.com/apache/spark/pull/24798#discussion_r291383439
 
 

 ##########
 File path: 
sql/catalyst/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBase.g4
 ##########
 @@ -111,6 +111,14 @@ statement
         (AS? query)?                                                   
#createHiveTable
     | CREATE TABLE (IF NOT EXISTS)? target=tableIdentifier
         LIKE source=tableIdentifier locationSpec?                      
#createTableLike
+    | replaceTableHeader ('(' colTypeList ')')? tableProvider
 
 Review comment:
   I'm not sure that we should support all of what's already here, at least not 
to begin with.
   
   I think that the main use of `REPLACE TABLE` as an atomic operation is 
`REPLACE TABLE ... AS SELECT`. That's because the replacement should only 
happen if the write succeeds and the write could easily fail for a lot of 
reasons. Without a write, this is just syntactic sugar for a combined drop and 
create.
   
   I think the initial PR should focus on just the RTAS case. That simplifies 
this because it no longer needs the type list. What do you think?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to