RestoreTableCommand does not even bother itself to check if the optional DeltaTimeTravelSpec (of the DeltaTableV2) is defined or not. It is assumed that it is available and so is the version.
run determines the version to restore based on the version or the timestamp (whatever defined). For the timestamp, run resolves the version by requesting the DeltaLog for the DeltaHistoryManager that in turn is requested for the active commit at that timestamp (with the canReturnLastCommit flag enabled).
Either the version or timestamp should be provided for restore
run asserts that either the version or timestamp are provided or throws an IllegalArgumentException:
Either the version or timestamp should be provided for restore
run requests the DeltaLog to update to find the latest version.
Version to restore should be less then last available version
run requires that the latest version of the delta table is higher than the requested version to restore or throws an IllegalArgumentException:
Version to restore ([versionToRestore])should be less then last available version ([latestVersion])
NB: You're right that there are a few typos in the exception message.
run requests the OptimisticTransaction for the latest (current) Snapshot.
run requests the DeltaLog for the Snapshot at the version to restore (snapshot to restore to) and reconciles them using all the files (in the snapshots).
run determines filesToAdd (as Dataset[AddFile]). run uses left_anti join on the Dataset[AddFile] of the snapshot to restore to with the current snapshot on path column. run marks the AddFiles (in the joined Dataset[AddFile]) as dataChange.
No Spark job started yet
No Spark job is started yet as run is only preparing it.
run determines filesToRemove (as Dataset[RemoveFile]). run uses left_anti join on the Dataset[AddFile] of the current snapshot with the snapshot to restore to on path column. run marks the AddFiles (in the joined Dataset[AddFile]) to be removed with the current timestamp.
No Spark job started yet
No Spark job is started yet as run is only preparing it.