Hi Artemiy,

It looks like a bug to me. The Javadoc of the V2 getUnionListState says
every subtask gets the union of all items, and I can reproduce the split on
2.3.0 and master. With the V2 descriptor the state is saved as
SPLIT_DISTRIBUTE, so a restore splits the entries across subtasks. With the
V1 descriptor it is saved as UNION and every subtask gets all of them.

SQL hits this too. With table.exec.async-state.enabled set to true, a
one-phase TUMBLE window aggregate saves its watermark state as
SPLIT_DISTRIBUTE. With the option off it is UNION.

I didn't find a JIRA for it. Would you like to open one? If not, I'm happy
to open it and work on a fix.

Best,
Sepuri Sai Krishna

On Tue, Nov 17, 2026 at 3:52 PM Lazarev Artemiy Maksimovich via dev <
[email protected]> wrote:

> Hi Flink developers,
>
> I found an apparent bug in the State V2 overload of
> DefaultOperatorStateBackend.getUnionListState in Flink 2.x.
>
> The implementation converts the V2 descriptor to V1, but delegates to
> getListState instead of getUnionListState:
>
> @Override
> public <S> org.apache.flink.api.common.state.v2.ListState<S>
> getUnionListState(
>         org.apache.flink.api.common.state.v2.ListStateDescriptor<S>
> stateDescriptor)
>         throws Exception {
>     return new OperatorListStateAdaptor<>(
>
> getListState(StateDescriptorUtils.transformFromV2ToV1(stateDescriptor)));
> }
>
> The getListState() method registers the state with Mode.SPLIT_DISTRIBUTE:
>
> import org.apache.flink.api.common.state.ListState;
> import org.apache.flink.api.common.state.ListStateDescriptor;
>
> @Override
> public <S> ListState<S> getListState(ListStateDescriptor<S>
> stateDescriptor) throws Exception {
>     return getListState(stateDescriptor,
> OperatorStateHandle.Mode.SPLIT_DISTRIBUTE);
> }
>
> Confirmed it for: 2.2.1<
> https://github.com/apache/flink/blob/release-2.2.1/flink-runtime/src/main/java/org/apache/flink/runtime/state/hashmap/HashMapStateBackend.java>,
> 2.3<
> https://github.com/apache/flink/blob/release-2.3.0/flink-runtime/src/main/java/org/apache/flink/runtime/state/DefaultOperatorStateBackend.java>
> and master (as of 2026-11-17).
>
>
> This is inconsistent with the union redistribution contract: each restored
> subtask should receive all saved entries, rather than a partition of them.
>
> Could you confirm whether this is a bug or intended behavior?
>
> Best regards,
> Artemiy Lazarev.
> ________________________________
> ??????????? ? ?????????????????? OZON: ????????? ?????? ? ??????????? ?
> ???? ????????? ???????? ???????????????? ?????????? ? ?????????????
> ???????? ??????. ???? ?? ?? ????????? ????????? ?????? ??? ???????? ??? ??
> ??????, ??????????, ???????? ?? ???? ??????????? ? ??????? ?????? ?
> ?????????? ? ???? ?? ???? ????? ?????????. ???????????, ????????? ???
> ??????????????? ?????? ? ?????????? ? ???? ??????, ??????? ?????? ??
> ???????????????, ???????? ????? ? ?????? ?????????. OZON CONFIDENTIALITY
> NOTICE: This email and any documents attached to it contain confidential
> information addressed to the intended recipient. If you are not the
> intended recipient or have received this email in error, please notify the
> sender and delete this email and all attachments hereto from all your
> devices. Copying, distribution or dissemination of this email and its
> attachments by any persons whom the email has not been intended to, are
> unlawful and strictly prohibited.
>

Reply via email to