Jane Chan created FLINK-34258:
---------------------------------
Summary: Incorrect example of accumulator usage within
emitUpdateWithRetract for TableAggregateFunction
Key: FLINK-34258
URL: https://issues.apache.org/jira/browse/FLINK-34258
Project: Flink
Issue Type: Bug
Components: Documentation, Table SQL / API
Affects Versions: 1.18.1, 1.19.0
Reporter: Jane Chan
Assignee: Jane Chan
The
[documentation|https://nightlies.apache.org/flink/flink-docs-master/docs/dev/table/functions/udfs/#retraction-example]
provides an example of using `emitUpdateWithRetract`. However, the example is
misleading as it incorrectly suggests that the accumulator can be updated
within the `emitUpdateWithRetract method`. In reality, the order of invocation
is to first call `getAccumulator` and then `emitUpdateWithRetract`, which means
that updating the accumulator within `emitUpdateWithRetract` will not take
effect. Please see
[GroupTableAggFunction#L141|https://github.com/apache/flink/blob/20450485b20cb213b96318b0c3275e42c0300e15/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/aggregate/GroupTableAggFunction.java#L141]
~
[GroupTableAggFunction#L146|https://github.com/apache/flink/blob/20450485b20cb213b96318b0c3275e42c0300e15/flink-table/flink-table-runtime/src/main/java/org/apache/flink/table/runtime/operators/aggregate/GroupTableAggFunction.java#L146]
for more details.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)