fresh-borzoni commented on code in PR #29653:
URL: https://github.com/apache/flink/pull/29653#discussion_r4424470638


##########
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/plan/nodes/physical/stream/StreamPhysicalSink.scala:
##########
@@ -147,8 +147,9 @@ class StreamPhysicalSink(
     val primaryKeys = 
contextResolvedTable.getResolvedSchema.getPrimaryKeyIndexes
     val pks = ImmutableBitSet.of(primaryKeys: _*)
     val fmq = FlinkRelMetadataQuery.reuseOrCreate(getCluster.getMetadataQuery)
-    val changeLogUpsertKeys = fmq.getUpsertKeys(getInput)
-    changeLogUpsertKeys != null && 
changeLogUpsertKeys.asScala.exists(pks.contains)
+    // upsert keys within the pk, treating equi-join-equivalent columns as 
interchangeable
+    val changeLogUpsertKeys = 
UpsertKeyEquivalenceUtil.upsertKeysWithin(getInput, pks, fmq)

Review Comment:
   Yes, intentional as that key is only read by the materializer, which is only 
added when no key fits the PK even with the equivalence, or with FORCE. The raw 
key is a real key of the input, so it's the right one there.



-- 
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]

Reply via email to