PreprocessTableRestore Logical Resolution¶
PreprocessTableRestore
is a logical resolution rule (Rule[LogicalPlan]
) to resolve delta tables in RestoreTableStatements.
Creating Instance¶
PreprocessTableRestore
takes the following to be created:
-
SparkSession
(Spark SQL)
PreprocessTableRestore
is created when:
DeltaSparkSessionExtension
is requested to register delta extensions
Executing Rule¶
apply(
plan: LogicalPlan): LogicalPlan
apply
is part of the Rule
(Spark SQL) abstraction.
apply
resolves RestoreTableStatements with UnresolvedRelation
s of delta tables to RestoreTableStatement
s with DeltaTableV2s.
RestoreTableStatement¶
For a RestoreTableStatement with a TimeTravel
on an UnresolvedRelation
, apply
tries to look up the relation in the SessionCatalog
(Spark SQL).
For a delta table, apply
requests the SessionCatalog
for a table metadata and creates a DeltaTableV2 (with the location from the catalog).
For a delta table registered in a catalog, apply
requests the SessionCatalog
for the metadata and creates a DeltaTableV2 (with the location from the catalog).
For the table identifier that is a valid path of a delta table, apply
creates a DeltaTableV2 (with the location).
Note
For all other cases, apply
throws an exception.
In the end, apply
creates a DataSourceV2Relation
with the DeltaTableV2
as a child of a new RestoreTableStatement.