JingsongLi commented on a change in pull request #16096:
URL: https://github.com/apache/flink/pull/16096#discussion_r651656766



##########
File path: 
flink-table/flink-table-planner-blink/src/main/java/org/apache/flink/table/planner/plan/metadata/FlinkMetadata.java
##########
@@ -238,4 +239,20 @@ ImmutableBitSet getUniqueGroups(
             RelWindowProperties getWindowProperties(RelNode r, 
RelMetadataQuery mq);
         }
     }
+
+    /** Metadata about which combinations of columns are change log upsert 
identifiers. */
+    public interface ChangeLogUpsertKeys extends Metadata {
+        Method METHOD = Types.lookupMethod(ChangeLogUpsertKeys.class, 
"getChangeLogUpsertKeys");
+
+        MetadataDef<ChangeLogUpsertKeys> DEF =
+                MetadataDef.of(
+                        ChangeLogUpsertKeys.class, 
ChangeLogUpsertKeys.Handler.class, METHOD);
+
+        Set<ImmutableBitSet> getChangeLogUpsertKeys();

Review comment:
       You can take a look to `getChangeLogUpsertKeys(rel: Rank, mq: 
RelMetadataQuery)`.
   
   - If the pk of changelog source is an extra field (f1) not partition 
key(f0). OK, this rank operator not output UpsertKey f1, but output UpsertKey 
f0 + rank_number. So if upsert sink pk is f1, OK, we need resolve records 
disorder. If upsert sink pk is f0 + rank_number, it is OK, we don't need do 
anything.
   - If the pk of changelog source is f0 + f2. Because this pk contains 
partition key, this rank operator can output UpsertKey source pk. Whether PK of 
sink is f0 + f2 or f0 + rank_number, we do not need do anything.




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to