Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
longvu-db committed Mar 11, 2024
1 parent ecbeef7 commit 5ef72ef
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.apache.spark.sql.delta.rowid

import org.apache.spark.sql.delta.{DeltaConfigs, DeltaIllegalStateException, DeltaLog, RowId}
import org.apache.spark.sql.delta.DeltaTestUtils.BOOLEAN_DOMAIN
import org.apache.spark.sql.delta.actions.TableFeatureProtocolUtils.TABLE_FEATURES_MIN_WRITER_VERSION
import org.apache.spark.sql.delta.sources.DeltaSQLConf

Expand Down Expand Up @@ -70,6 +71,22 @@ class RowIdCloneSuite
}
}

test("self-clone an empty table") {
for (enableRowIdsForSource <- BOOLEAN_DOMAIN) {
withTables(
TableSetupInfo(tableName = "source",
rowIdsEnabled = enableRowIdsForSource, tableState = TableState.EMPTY)) {
cloneTable(targetTableName = "source", sourceTableName = "source")

val (targetLog, snapshot) =
DeltaLog.forTableWithSnapshot(spark, TableIdentifier("source"))
assertRowIdsAreNotSet(targetLog)
assert(RowId.isSupported(targetLog.update().protocol) === enableRowIdsForSource)
assert(RowId.isEnabled(snapshot.protocol, snapshot.metadata) === enableRowIdsForSource)
}
}
}

test("clone that add row ID feature using table property override " +
"doesn't enable row IDs on target") {
withTables(
Expand Down

0 comments on commit 5ef72ef

Please sign in to comment.