Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ctringdb committed Oct 24, 2024
1 parent 1b8979f commit cb77960
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -876,9 +876,9 @@ object DeltaLog extends DeltaLogging {
thunk: Clock => (DeltaLog, Option[CatalogTable])): (DeltaLog, Snapshot) = {
val clock = new SystemClock
val ts = clock.getTimeMillis()
val (deltaLog, catalogTable) = thunk(clock)
val (deltaLog, catalogTableOpt) = thunk(clock)
val snapshot =
deltaLog.update(checkIfUpdatedSinceTs = Some(ts), catalogTableOpt = catalogTable)
deltaLog.update(checkIfUpdatedSinceTs = Some(ts), catalogTableOpt = catalogTableOpt)
(deltaLog, snapshot)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ case class RestoreTableCommand(sourceTable: DeltaTableV2)

override def run(spark: SparkSession): Seq[Row] = {
val deltaLog = sourceTable.deltaLog
val catalogTable = sourceTable.catalogTable
val catalogTableOpt = sourceTable.catalogTable
val version = sourceTable.timeTravelOpt.get.version
val timestamp = getTimestamp()
recordDeltaOperation(deltaLog, "delta.restore") {
Expand All @@ -107,17 +107,17 @@ case class RestoreTableCommand(sourceTable: DeltaTableV2)
}

val latestVersion = deltaLog
.update(catalogTableOpt = catalogTable)
.update(catalogTableOpt = catalogTableOpt)
.version

require(versionToRestore < latestVersion, s"Version to restore ($versionToRestore)" +
s"should be less then last available version ($latestVersion)")

deltaLog.withNewTransaction(catalogTable) { txn =>
deltaLog.withNewTransaction(catalogTableOpt) { txn =>
val latestSnapshot = txn.snapshot
val snapshotToRestore = deltaLog.getSnapshotAt(
versionToRestore,
catalogTableOpt = catalogTable)
catalogTableOpt = catalogTableOpt)
val latestSnapshotFiles = latestSnapshot.allFiles
val snapshotToRestoreFiles = snapshotToRestore.allFiles

Expand Down

0 comments on commit cb77960

Please sign in to comment.