Skip to content

DeltaAnalysis Logical Resolution Rule

DeltaAnalysis is a logical resolution rule (Spark SQL).

Creating Instance

DeltaAnalysis takes the following to be created:

  • SparkSession
  • SQLConf

DeltaAnalysis is created when:

Executing Rule

apply(
  plan: LogicalPlan): LogicalPlan

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

apply resolves 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.

AppendDelta

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

UpdateTable


Last update: 2021-06-12