huaxingao commented on a change in pull request #35239:
URL: https://github.com/apache/spark/pull/35239#discussion_r793255420



##########
File path: docs/sql-ref-syntax-ddl-alter-table.md
##########
@@ -101,6 +145,27 @@ ALTER TABLE table_identifier { ALTER | CHANGE } [ COLUMN ] 
col_spec alterColumnA
 
     Change column's definition.
 
+### REPLACE COLUMNS
+
+`ALTER TABLE REPLACE COLUMNS` statement removes all existing columns and adds 
the new set of columns.
+Note that this statement is only supported with v2 tables.
+
+
+#### Syntax
+
+```sql
+ALTER TABLE table_identifier REPLACE COLUMNS  
+  [ ( col_name1 col_type1 [ COMMENT col_comment1 ], ... ) ]
+```

Review comment:
       This one is a little complicated. Here is the syntax:
   ```
       | ALTER TABLE table=multipartIdentifier partitionSpec?
           REPLACE COLUMNS
           '(' columns=qualifiedColTypeWithPositionList ')'    
   
   qualifiedColTypeWithPositionList
       : qualifiedColTypeWithPosition (',' qualifiedColTypeWithPosition)*
       ;
   
   qualifiedColTypeWithPosition
       : name=multipartIdentifier dataType (NOT NULL)? commentSpec? colPosition?
       ;
   ```
   Could you please make the syntax more accurate?




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