Skip to content

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:

PreprocessTableRestore is created when:

Executing Rule

apply(
  plan: LogicalPlan): LogicalPlan

apply is part of the Rule (Spark SQL) abstraction.

apply resolves RestoreTableStatements with UnresolvedRelations of delta tables to RestoreTableStatements 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.