jacktby jacktby
08/13/2023, 5:15 AM// N + 1 (or N + 2 with CDC, N + 4 preserving Row Tracking and CDC) expressions to delete the
// unmatched source row when it should not be inserted. `target.output` will produce NULLs
// which will get deleted eventually.
val deleteSourceRowExprs =
(targetOutputCols ++
Seq(Literal(true))) ++
(if (cdcEnabled) Seq(CDC_TYPE_NOT_CDC) else Seq())
// ==== Generate N + 2 (N + 4 preserving Row Tracking) expressions for NOT MATCHED clause ====
val processedNotMatchClauses: Seq[ProcessedClause] = generateAllActionExprs(
targetOutputCols,
clausesWithPrecompConditions.collect{ case c: DeltaMergeIntoNotMatchedClause => c },
cdcEnabled,
shouldCountDeletedRows)
val notMatchedExprs: Seq[Expression] = generateClauseOutputExprs(
numOutputCols,
processedNotMatchClauses,
deleteSourceRowExprs)