[ https://issues.apache.org/jira/browse/SPARK-30614?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17027878#comment-17027878 ]
Terry Kim commented on SPARK-30614: ----------------------------------- Currently, ALTER COLUMN requires TYPE property for v1 tables: [https://github.com/apache/spark/blob/master/sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala#L80] For example, you have to run {code:sql} ALTER TABLE t ALTER COLUMN i TYPE bigint COMMENT 'new comment' {code} but not {code:sql} ALTER TABLE $tblName ALTER COLUMN i COMMENT 'new comment' {code} It's OK to break this behavior, right? (we can deduce the column type since the table is already looked up.) > 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 > Priority: Major > > Our native ALTER COLUMN syntax is newly added in 3.0 and almost follows the > SQL standard. > {code} > ALTER TABLE table=multipartIdentifier > (ALTER | CHANGE) COLUMN? column=multipartIdentifier > (TYPE dataType)? > (COMMENT comment=STRING)? > colPosition? > {code} > 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