Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1061,6 +1061,7 @@ case class MergeIntoTable(
actions.forall {
case a: UpdateAction => MergeIntoTable.areSchemaEvolutionReady(a.assignments, sourceTable)
case a: InsertAction => MergeIntoTable.areSchemaEvolutionReady(a.assignments, sourceTable)
case _: DeleteAction => true
case _ => false
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1245,4 +1245,24 @@ trait MergeIntoSchemaEvolutionBasicTests extends MergeIntoSchemaEvolutionSuiteBa
expectErrorWithoutEvolutionContains = "A column, variable, or function parameter with name " +
"`bonus` cannot be resolved"
)

testEvolution("source has extra column with delete action")(
Comment thread
johanl-db marked this conversation as resolved.
targetData = Seq((1, "hr"), (2, "software")).toDF("pk", "dep"),
sourceData = Seq((2, "dummy", 200), (3, "dummy", 300)).toDF("pk", "dep", "salary"),
clauses = Seq(delete(), insertAll()),
expected = Seq[(Int, String, java.lang.Integer)](
(1, "hr", null),
(3, "dummy", 300)).toDF("pk", "dep", "salary"),
expectedWithoutEvolution = Seq(
(1, "hr"),
(3, "dummy")).toDF("pk", "dep")
)

testEvolution("delete-only action does not trigger schema evolution")(
targetData = Seq((1, "hr"), (2, "software")).toDF("pk", "dep"),
sourceData = Seq((2, "dummy", 200)).toDF("pk", "dep", "salary"),
clauses = Seq(delete()),
expected = Seq((1, "hr")).toDF("pk", "dep"),
expectedWithoutEvolution = Seq((1, "hr")).toDF("pk", "dep")
)
}