3. Given the following Spark code snippet, what will be the output count of rows in
targetTable after the merge?
val sourceDF = spark.createDataFrame(Seq((1, "A"), (3, "C"))).toDF("id", "value")
val deltaTable = DeltaTable.forName("targetTable")
deltaTable.merge(sourceDF, "target.id = source.id")
.whenMatchedUpdateExpr(Map("value" -> "source.value"))
.whenNotMatchedInsertExpr(Map("id" -> "source.id", "value" -> "source.value"))
.execute()
val count = spark.table("targetTable").count()
Assuming
targetTable initially has rows with ids 1 and 2.