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:
DeltaSparkSessionExtension
is requested to register Delta extensions
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:
- DeltaMergeIntoDeleteClauses for
DeleteAction
s - DeltaMergeIntoUpdateClauses for
UpdateAction
s
apply
throws an AnalysisException
for InsertAction
s:
Insert clauses cannot be part of the WHEN MATCHED clause in MERGE INTO.
apply
creates the following for the notMatched
actions:
- DeltaMergeIntoInsertClauses for
InsertAction
s
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).