raminqaf commented on code in PR #28235:
URL: https://github.com/apache/flink/pull/28235#discussion_r3310136213
##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/ToChangelogFunction.java:
##########
@@ -84,7 +94,48 @@ public ToChangelogFunction(final SpecializedContext context)
{
if (opMapping != null) {
validateOpMap(this.rawOpMap, tableSemantics);
}
+ final boolean producesFullDeletesArg =
+ callContext.getArgumentValue(3, Boolean.class).orElse(false);
+ validateProducesFullDeletes(producesFullDeletesArg, tableSemantics);
+
this.outputIndices =
ChangelogTypeStrategyUtils.computeOutputIndices(tableSemantics);
+ this.inputRowType = (RowType)
tableSemantics.dataType().getLogicalType();
+ final int[] upsertKeys = tableSemantics.upsertKeyColumns();
+ this.producesFullDelete =
resolveProducesFullDelete(producesFullDeletesArg, tableSemantics);
+ this.preserveOnDelete = computePreserveOnDelete(this.outputIndices,
upsertKeys);
+ }
+
+ /**
+ * Decides whether this function emits full DELETE rows (input passed
through unchanged) or
+ * partial DELETE rows (only identifying columns preserved, rest nulled).
+ *
+ * <p>The framework prepends partition-key columns to the output without
consulting this
+ * function, so in set semantics partition keys are preserved on DELETE
rows for free. In row
+ * semantics we rely on the input table's upsert key to identify columns.
Without either signal
+ * we cannot null anything safely and fall back to passing the input
through unchanged, which is
+ * equivalent to a full delete.
+ */
+ private static boolean resolveProducesFullDelete(
Review Comment:
Changed to full deletes by default now!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]