cloud-fan commented on a change in pull request #33113:
URL: https://github.com/apache/spark/pull/33113#discussion_r663634209
##########
File path:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/CheckAnalysis.scala
##########
@@ -1088,8 +1058,51 @@ trait CheckAnalysis extends PredicateHelper with
LookupCatalog {
}
alter match {
- case AlterTableRenameColumn(table: ResolvedTable,
ResolvedFieldName(name), newName) =>
- checkColumnNotExists(name.init :+ newName, table.schema)
+ case AlterTableRenameColumn(table: ResolvedTable, col:
ResolvedFieldName, newName) =>
+ checkColumnNotExists(col.path :+ newName, table.schema)
+ case a @ AlterTableAlterColumn(table: ResolvedTable, col:
ResolvedFieldName, _, _, _, _) =>
+ val fieldName = col.name.quoted
+ if (a.dataType.isDefined) {
+ val field = CharVarcharUtils.getRawType(col.field.metadata)
+ .map(dt => col.field.copy(dataType = dt))
+ .getOrElse(col.field)
+ val newDataType = a.dataType.get
+ newDataType match {
Review comment:
Not related to this PR: I think there is a small bug here, if the data
type is not changed, we shouldn't fail even if the new data type is
struct/array/map. @imback82 can you help to fix it?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]