gustavodemorais commented on code in PR #30182:
URL: https://github.com/apache/flink/pull/30182#discussion_r4773018559


##########
flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/functions/ptf/Deduplicate.java:
##########
@@ -19,21 +19,35 @@
 package org.apache.flink.table.runtime.functions.ptf;
 
 import org.apache.flink.annotation.Internal;
+import org.apache.flink.table.connector.ChangelogMode;
 import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
+import org.apache.flink.table.functions.TableSemantics;
 import org.apache.flink.table.functions.UserDefinedFunction;
 import org.apache.flink.table.functions.definitions.DeduplicateDefinition;
 import org.apache.flink.table.functions.definitions.DeduplicateDefinition.Keep;
 import org.apache.flink.table.runtime.functions.BuiltInSpecializedFunction;
 import org.apache.flink.table.types.inference.CallContext;
+import org.apache.flink.table.types.inference.utils.CallContextUtils;
+import org.apache.flink.types.RowKind;
+
+import java.util.Arrays;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static 
org.apache.flink.table.functions.definitions.DeduplicateDefinition.ARG_INPUT;
 
 /**
  * Runtime implementation of {@link BuiltInFunctionDefinitions#DEDUPLICATE}.
  *
  * <pre>
- * keep    sequence_by  implementation
- * first   absent       {@link DeduplicateEmitOnceFunction}
- * first   present      {@link DeduplicateCurrentRowFunction}
- * last    any          {@link DeduplicateCurrentRowFunction}
+ * input                                  keep    sequence_by  implementation
+ * insert-only                            first   absent       {@link 
DeduplicateEmitOnceFunction}
+ * insert-only                            first   present      {@link 
DeduplicateCurrentRowFunction}
+ * insert-only                            last    any          {@link 
DeduplicateCurrentRowFunction}
+ * updating, PARTITION BY has upsert key  any     any          {@link 
DeduplicatePassThroughFunction},
+ *                                                             or {@link 
DeduplicateKeyedRowFunction}
+ *                                                             if the output 
needs -U or full -D
+ * updating, other                        any     any          {@link 
DeduplicateLiveRowsFunction}

Review Comment:
   Okay, I've spent some time thinking about the names.
   
   The suggestion that felt the most intuitive to me: name the variants after 
the input they handle and what they do.
   - EXPLAIN shows the input's changelog mode, and each variant gets exactly 
one kind of input, so a class name in a flame graph or stack trace maps back to 
the plan.
   - It also avoids "CurrentRow", since several variants keep a current row now.
   
   This would need the classes renamed accordingly:
   
   ```suggestion
    * input    keep    sequence_by  implementation
    * append   first   absent       {@link DeduplicateAppendEmitOnceFunction}
    * append   first   present      {@link DeduplicateAppendReplaceFunction}
    * append   last    any          {@link DeduplicateAppendReplaceFunction}
    * upsert   any     any          {@link DeduplicateUpsertForwardFunction},
    *                               or {@link 
DeduplicateUpsertNormalizeFunction}
    *                               if the output needs -U or full -D
    * retract  any     any          {@link DeduplicateRetractFunction}
    *
    * upsert: the PARTITION BY columns are an upsert key of the input, so a key 
has at most one row
    * retract: any other updating input, so a key can have several rows
   ```



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