Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Spark][Test-Only] Add Row Tracking self-Clone tests #2743

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,21 @@ class RowIdCloneSuite
}
}

for (enableRowIdsForSource <- BOOLEAN_DOMAIN)
test("self-clone an empty table does not change the table's Row Tracking " +
s"enablement and does not set Row IDs, enableRowIdsForSource=$enableRowIdsForSource") {
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
Loading