twalthr commented on code in PR #30173:
URL: https://github.com/apache/flink/pull/30173#discussion_r4721707096


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/types/inference/StaticArgumentTrait.java:
##########
@@ -65,12 +65,12 @@ public enum StaticArgumentTrait {
     REQUIRE_FULL_DELETE(SUPPORT_UPDATES),
 
     /**
-     * Specifies that the function reads only INSERT and UPDATE_AFTER rows of 
this table argument
-     * and ignores UPDATE_BEFORE and DELETE rows, which may therefore be 
incomplete or missing.
+     * Specifies that the function reads only INSERT and UPDATE_AFTER rows of 
this table argument.
      *
-     * <p>The planner then needs no ChangelogNormalize in front of the 
function, for example when
-     * the input has no upsert key, filters on non-key columns, or reads 
metadata columns. Reserved
-     * for built-in functions.
+     * <p>The function never receives UPDATE_BEFORE or DELETE rows of this 
table argument. It must
+     * not depend on them, for example to learn the previous version of a row 
or that a row was
+     * deleted. In return, the job can be considerably cheaper, since the 
engine can drop the
+     * stateful normalization that retractions and deletions often require.
      */
     IGNORE_RETRACTIONS(SUPPORT_UPDATES);

Review Comment:
   nit: since ArgumentTrait has the JavaDoc now, we could remove it here.



##########
docs/content.zh/docs/dev/table/functions/ptfs.md:
##########
@@ -1794,6 +1796,36 @@ SELECT * FROM f(table_arg => TABLE UpdatingTable 
PARTITION BY name)
 // In both encodings, a materialized table would only contain a row for Alice.
 ```
 
+#### Ignoring Retractions
+
+The `ArgumentTrait.IGNORE_RETRACTIONS` instructs the system that a table 
argument which `SUPPORT_UPDATES` reads only
+`RowKind.INSERT` and `RowKind.UPDATE_AFTER` messages. The function never 
receives `RowKind.UPDATE_BEFORE` or
+`RowKind.DELETE` messages, so it must not rely on them, for example to learn 
the previous version of a row or that a
+row was deleted.
+
+In return, the system can provide the updating table more cheaply. It drops 
retractions early and needs neither an
+upsert key nor a stateful normalization of an upsert changelog in front of the 
function.
+
+```java
+public void eval(@ArgumentHint({ROW_SEMANTIC_TABLE, SUPPORT_UPDATES, 
IGNORE_RETRACTIONS}) Row input) {

Review Comment:
   I would use a set semantic table here, as this is a more common use case



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