You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Jane Chan (Jira)" <ji...@apache.org> on 2024/01/29 08:54:00 UTC

[jira] [Updated] (FLINK-34258) Incorrect example of accumulator usage within emitUpdateWithRetract for TableAggregateFunction

     [ https://issues.apache.org/jira/browse/FLINK-34258?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jane Chan updated FLINK-34258:
------------------------------
    Attachment: GroupTableAggHandler$10.java

> 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.19.0, 1.18.1
>            Reporter: Jane Chan
>            Priority: Minor
>         Attachments: GroupTableAggHandler$10.java
>
>
> 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)