Wenchen Fan created SPARK-30614:
-----------------------------------

             Summary: The native ALTER COLUMN syntax should change one thing at 
a time
                 Key: SPARK-30614
                 URL: https://issues.apache.org/jira/browse/SPARK-30614
             Project: Spark
          Issue Type: New Feature
          Components: SQL
    Affects Versions: 3.0.0
            Reporter: Wenchen Fan


Our native ALTER COLUMN syntax is newly added in 3.0 and almost follows the SQL 
standard.

{{{
ALTER TABLE table=multipartIdentifier
  (ALTER | CHANGE) COLUMN? column=multipartIdentifier
  (TYPE dataType)?
  (COMMENT comment=STRING)?
  colPosition?   
}}}

The SQL standard (section 11.12) only allows changing one property at a time. 
This is also true on other recent SQL systems like 
snowflake(https://docs.snowflake.net/manuals/sql-reference/sql/alter-table-column.html)
 and redshift(https://docs.aws.amazon.com/redshift/latest/dg/r_ALTER_TABLE.html)

The snowflake has an extension that it allows changing multiple columns at a 
time, like ALTER COLUMN c1 TYPE int, c2 TYPE int. If we want to extend the SQL 
standard, I think this syntax is better. 

For now, let's be conservative and only allow changing one property at a time.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

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

Reply via email to