Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
zhipengmao-db committed Jul 30, 2024
1 parent 3b04de5 commit 7b73cb1
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,18 @@ trait IdentityColumnSyncSuiteBase
test("alter table sync identity delta") {
val starts = Seq(-1, 1)
val steps = Seq(-3, 3)
for (start <- starts; step <- steps) {
val alterKeywords = Seq("ALTER", "CHANGE")
for (start <- starts; step <- steps; alterKeyword <- alterKeywords) {
withSimpleGeneratedByDefaultTable(start, step) {
// Test empty table.
val oldSchema = DeltaLog.forTable(spark, TableIdentifier(tblName)).snapshot.schema
sql(s"ALTER TABLE $tblName ALTER COLUMN id SYNC IDENTITY")
sql(s"ALTER TABLE $tblName $alterKeyword COLUMN id SYNC IDENTITY")
assert(DeltaLog.forTable(spark, TableIdentifier(tblName)).snapshot.schema == oldSchema)

// Test a series of values that are not all following start and step configurations.
for (i <- start to (start + step * 10)) {
sql(s"INSERT INTO $tblName VALUES($i, 'v')")
sql(s"ALTER TABLE $tblName ALTER COLUMN id SYNC IDENTITY")
sql(s"ALTER TABLE $tblName $alterKeyword COLUMN id SYNC IDENTITY")
val expected = start + (((i - start) + (step - 1)) / step) * step
val schema = DeltaLog.forTable(spark, TableIdentifier(tblName)).snapshot.schema
assert(schema("id").metadata.getLong(DeltaSourceUtils.IDENTITY_INFO_HIGHWATERMARK) ==
Expand Down

0 comments on commit 7b73cb1

Please sign in to comment.