snuyanzin commented on code in PR #25707:
URL: https://github.com/apache/flink/pull/25707#discussion_r1861852208


##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/annotation/FunctionHint.java:
##########
@@ -175,13 +178,40 @@
     ArgumentHint[] arguments() default {};
 
     /**
-     * Explicitly defines the intermediate result type that a function uses as 
accumulator.
+     * Explicitly defines the intermediate result type (i.e. state entry) that 
an aggregating
+     * function uses as its accumulator. The entry is managed by the framework 
(usually via Flink's
+     * managed state).
      *
      * <p>By default, an explicit accumulator type is undefined and the 
reflection-based extraction
      * is used.
+     *
+     * <p>This parameter is primarily intended for aggregating functions (i.e. 
{@link
+     * AggregateFunction} and {@link TableAggregateFunction}). It is 
recommended to use {@link
+     * #state()} for {@link ProcessTableFunction}.
      */
     DataTypeHint accumulator() default @DataTypeHint();
 
+    /**
+     * Explicitly lists the intermediate results (i.e. state entries) of a 
function that is managed
+     * by the framework (i.e. Flink managed state). Including their names and 
data types.
+     *
+     * <p>State hints are primarily intended for {@link ProcessTableFunction}. 
A PTF supports
+     * multiple state entries at the beginning of an eval()/onTimer() method 
(after an optional
+     * context parameter).
+     *
+     * <p>Aggregating functions (i.e. {@link AggregateFunction} and {@link 
TableAggregateFunction})
+     * support a single state entry at the beginning of an 
accumulate()/retract() method (i.e. the
+     * accumulator).
+     *
+     * <p>By default, explicit state is undefined and the reflection-based 
extraction is used where
+     * {@link StateHint} is present.
+     *
+     * <p>Using both {@link #accumulator()} and this parameter is not allowed. 
Specifying the list
+     * of state entries manually disables the entire reflection-based 
extraction around {@link
+     * StateHint} and accumulators for aggregating functions.

Review Comment:
   Should it also be mentioned in doc? Somewhere here e.g.
   
https://github.com/apache/flink/blob/b9c92371dba07b6bfe4368d7b6d7f7c575b4c603/docs/content/docs/dev/table/functions/udfs.md?plain=1#L439



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to