diff --git a/spark/src/main/scala/io/delta/sql/parser/DeltaSqlParser.scala b/spark/src/main/scala/io/delta/sql/parser/DeltaSqlParser.scala index b6c3611932..9788879a24 100644 --- a/spark/src/main/scala/io/delta/sql/parser/DeltaSqlParser.scala +++ b/spark/src/main/scala/io/delta/sql/parser/DeltaSqlParser.scala @@ -561,7 +561,7 @@ class DeltaSqlAstBuilder extends DeltaSqlBaseBaseVisitor[AnyRef] { } /** - * `ALTER TABLE ... ALTER COLUMN ... SYNC IDENTITY` command. + * `ALTER TABLE ... ALTER (CHANGE) COLUMN ... SYNC IDENTITY` command. */ override def visitAlterTableSyncIdentity( ctx: AlterTableSyncIdentityContext): LogicalPlan = withOrigin(ctx) { diff --git a/spark/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SyncIdentity.scala b/spark/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SyncIdentity.scala index 51f7f94515..9349c250bd 100644 --- a/spark/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SyncIdentity.scala +++ b/spark/src/main/scala/org/apache/spark/sql/catalyst/plans/logical/SyncIdentity.scala @@ -29,10 +29,8 @@ case class SyncIdentity(fieldNames: Array[String]) extends ColumnChange { require(fieldNames.size == 1, "IDENTITY column cannot be a nested column.") } -case class AlterColumnSyncIdentity( - table: LogicalPlan, - column: FieldName) - extends AlterTableCommand { +case class AlterColumnSyncIdentity(table: LogicalPlan, column: FieldName) + extends AlterTableCommand { override def changes: Seq[TableChange] = { require(column.resolved, "FieldName should be resolved before it's converted to TableChange.") val colName = column.name.toArray diff --git a/spark/src/test/scala/org/apache/spark/sql/delta/IdentityColumnSyncSuite.scala b/spark/src/test/scala/org/apache/spark/sql/delta/IdentityColumnSyncSuite.scala index 9b8c279661..9bfbf7f357 100644 --- a/spark/src/test/scala/org/apache/spark/sql/delta/IdentityColumnSyncSuite.scala +++ b/spark/src/test/scala/org/apache/spark/sql/delta/IdentityColumnSyncSuite.scala @@ -205,7 +205,9 @@ trait IdentityColumnSyncSuiteBase test("alter table sync identity overflow error") { withSimpleGeneratedByDefaultTable(startsWith = 1L, incrementBy = 10L) { sql(s"INSERT INTO $tblName VALUES (${Long.MaxValue}, 'a')") - intercept[ArithmeticException](sql(s"ALTER TABLE $tblName ALTER COLUMN id SYNC IDENTITY")) + assertThrows[ArithmeticException] { + sql(s"ALTER TABLE $tblName ALTER COLUMN id SYNC IDENTITY") + } } }