Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/15717#discussion_r91862195
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
    @@ -274,6 +274,63 @@ case class AlterTableUnsetPropertiesCommand(
     
     }
     
    +
    +/**
    + * A command to change the columns for a table, only support changing 
column comment for now.
    + *
    + * The syntax of using this command in SQL is:
    + * {{{
    + *   ALTER TABLE table_identifier
    + *   CHANGE [COLUMN] column_old_name column_new_name column_dataType 
[COMMENT column_comment]
    + *   [FIRST | AFTER column_name];
    + * }}}
    + */
    +case class AlterTableChangeColumnsCommand(
    +    tableName: TableIdentifier,
    +    columns: Map[String, StructField]) extends RunnableCommand {
    +
    +  // TODO: support change column name/dataType/metadata/position.
    +  override def run(sparkSession: SparkSession): Seq[Row] = {
    +    val catalog = sparkSession.sessionState.catalog
    +    val table = catalog.getTableMetadata(tableName)
    +    DDLUtils.verifyAlterTableType(catalog, table, isView = false)
    +    // Currently only support changing column comment, throw a Exception 
if other fields e.g.
    +    // name/dataType are changed.
    +    columns.foreach { case (oldColumnName, newColumn) =>
    +      val originColumn = table.schema.collectFirst {
    +        case field if field.name == oldColumnName => field
    --- End diff --
    
    How about case sensitivity?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

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

Reply via email to