johanl-db commented on code in PR #46734: URL: https://github.com/apache/spark/pull/46734#discussion_r1613401422
########## sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala: ########## @@ -396,8 +396,9 @@ case class AlterTableChangeColumnCommand( val newDataSchema = table.dataSchema.fields.map { field => if (field.name == originColumn.name) { // Create a new column from the origin column with the new comment. + val newField = field.copy(dataType = newColumn.dataType) Review Comment: Can you make it more explicit that we effectively allow the data type to change now but we only allow type changes that differ by collation? E.g. by splitting `columnEqual` into checking that names match on one side and that the type change is supported on the other + add a ` withNewType` method. ########## sql/core/src/main/scala/org/apache/spark/sql/execution/command/ddl.scala: ########## @@ -396,8 +396,9 @@ case class AlterTableChangeColumnCommand( val newDataSchema = table.dataSchema.fields.map { field => if (field.name == originColumn.name) { // Create a new column from the origin column with the new comment. + val newField = field.copy(dataType = newColumn.dataType) Review Comment: Lines 359-367: the comment needs to be updated to be clear we now allow changing collation. Side note: it gives the hive-style syntax for ALTER COLUMN but that's only one of the two syntaxes, see: https://github.com/apache/spark/blob/master/sql/api/src/main/antlr4/org/apache/spark/sql/catalyst/parser/SqlBaseParser.g4#L130 The other one is the one (partially) documented and the more capable/preferred one: https://spark.apache.org/docs/3.5.1/sql-ref-syntax-ddl-alter-table.html#parameters-4 -- 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: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org