[
https://issues.apache.org/jira/browse/FLINK-41104?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dian Fu resolved FLINK-41104.
-----------------------------
Fix Version/s: 1.20.6
2.3.1
2.4.0
Resolution: Fixed
Fixed in:
- master via 379201f50d9c767a96c767d9d4863961d7c674c8
- release-2.4 via 1e66e575e90227fe16f5f704c4e1a7e189d91278
- release-2.3 via e8f946a1b4767c37b4e2a1d977f90d2514bf49dd
- release-1.20 via 43f0b465d5033962ae70e96e0d9fa65b7897a6fa
> MapState.contains() returns false for an existing key whose value is None
> -------------------------------------------------------------------------
>
> Key: FLINK-41104
> URL: https://issues.apache.org/jira/browse/FLINK-41104
> Project: Flink
> Issue Type: Bug
> Components: API / Python
> Reporter: Dian Fu
> Assignee: Sangkyoon Nam
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.20.6, 2.3.1, 2.4.0
>
>
> In PyFlink process mode, MapState.contains(key) incorrectly treats an
> existing mapping with a None value as an absent entry.
> Reproduction:
> {code:python}
> state.put(1, None)
> state.contains(1) # Returns False
> {code}
> Expected:
> contains(1) returns True while the mapping exists, and returns False after
> the key is removed.
> Actual:
> It returns False for the existing mapping, both before commit and after
> commit. The behavior also occurs with an uncached backend response.
> Root cause:
> InternalSynchronousMapRuntimeState.contains() determines membership using
> self.get(map_key) is not None. This loses the distinction between a missing
> entry and an existing null-valued entry, although the write cache and
> map-state protocol preserve an explicit existence flag.
> The affected implementation is in
> flink-python/pyflink/fn_execution/state_impl.py. Membership checks should use
> entry existence rather than value nullness.
> Regression tests should cover null-valued, non-null-valued, missing, and
> removed entries across buffered, cached, and uncached reads, including the
> "key in state" syntax.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)