From cb77960aa3966460f79683a8ba85129dba0e1b64 Mon Sep 17 00:00:00 2001 From: Cuong Nguyen Date: Thu, 24 Oct 2024 15:26:40 -0700 Subject: [PATCH] minor changes --- .../main/scala/org/apache/spark/sql/delta/DeltaLog.scala | 4 ++-- .../spark/sql/delta/commands/RestoreTableCommand.scala | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/spark/src/main/scala/org/apache/spark/sql/delta/DeltaLog.scala b/spark/src/main/scala/org/apache/spark/sql/delta/DeltaLog.scala index 23e564d98f..4c1d4a9364 100644 --- a/spark/src/main/scala/org/apache/spark/sql/delta/DeltaLog.scala +++ b/spark/src/main/scala/org/apache/spark/sql/delta/DeltaLog.scala @@ -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) } diff --git a/spark/src/main/scala/org/apache/spark/sql/delta/commands/RestoreTableCommand.scala b/spark/src/main/scala/org/apache/spark/sql/delta/commands/RestoreTableCommand.scala index 393aa9fbce..f771335e7f 100644 --- a/spark/src/main/scala/org/apache/spark/sql/delta/commands/RestoreTableCommand.scala +++ b/spark/src/main/scala/org/apache/spark/sql/delta/commands/RestoreTableCommand.scala @@ -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") { @@ -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