Skip to content

DeltaAnalysis Logical Resolution Rule

DeltaAnalysis is a logical resolution rule (Spark SQL).

Creating Instance

DeltaAnalysis takes the following to be created:

DeltaAnalysis is created when:

Executing Rule

apply(
  plan: LogicalPlan): LogicalPlan

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


apply resolves the following logical operators.

AlterTableAddConstraintStatement

apply creates an AlterTable (Spark SQL) logical command with an AddConstraint table change.

AlterTableDropConstraintStatement

apply creates an AlterTable (Spark SQL) logical command with an DropConstraint table change.

AppendData

For AppendData (Spark SQL), apply tries to destructure it to a pair of DataSourceV2Relation (Spark SQL) and a DeltaTableV2.

apply proceeds for AppendData operators that are not isByName.

apply...FIXME

DataSourceV2Relation

DeleteFromTable

DeltaTable

MergeIntoTable

MergeIntoTable(target, source, condition, matched, notMatched)

apply resolves MergeIntoTable (Spark SQL) logical command into a DeltaMergeInto.

apply creates the following for the matched actions:

apply throws an AnalysisException for InsertActions:

Insert clauses cannot be part of the WHEN MATCHED clause in MERGE INTO.

apply creates the following for the notMatched actions:

apply throws an AnalysisException for the other actions:

[name] clauses cannot be part of the WHEN NOT MATCHED clause in MERGE INTO.

In the end, apply creates a DeltaMergeInto logical command (with the matched and not-matched actions).

OverwriteDelta

RestoreTableStatement

UpdateTable