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

    https://github.com/apache/spark/pull/19773#discussion_r216175940
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala ---
    @@ -350,16 +366,11 @@ case class AlterTableChangeColumnCommand(
             s"${schema.fieldNames.mkString("[`", "`, `", "`]")}"))
       }
     
    -  // Add the comment to a column, if comment is empty, return the original 
column.
    -  private def addComment(column: StructField, comment: Option[String]): 
StructField = {
    -    comment.map(column.withComment(_)).getOrElse(column)
    -  }
    -
    --- End diff --
    
    ah.... ok. Although the query above doesn't work well, why do users change 
column types?
    Basically, the query should work? e.g., in postgresql
    ```
    postgres=# create table t(a int, b varchar);
    CREATE TABLE
    postgres=# insert into t values(1, 'a');
    INSERT 0 1
    postgres=# alter table t alter column a TYPE varchar;
    ALTER TABLE
    postgres=# select * from t;
     a | b 
    ---+---
     1 | a
    (1 row)
    
    postgres=# \d t
                Table "public.t"
     Column |       Type        | Modifiers 
    --------+-------------------+-----------
     a      | character varying | 
     b      | character varying | 
    ```


---

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

Reply via email to