[
https://issues.apache.org/jira/browse/FLINK-41106?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Dian Fu resolved FLINK-41106.
-----------------------------
Fix Version/s: 1.20.6
2.3.1
2.4.0
Resolution: Fixed
Fixed in:
- master via 69285481f8d9fe3dc2e86456140582553e9ecce2
- release-2.4 via 115411caa36302f630e9c9297a316e41c272ff44
- release-2.3 via d0ad2483db1b8b504709c53e6f6bad5fd01d31d8
- release-1.20 via 8d2ccf98613479d705365aec4ad2828418777add
> MapState.put_all() iterates dictionary keys instead of key-value pairs
> ----------------------------------------------------------------------
>
> Key: FLINK-41106
> URL: https://issues.apache.org/jira/browse/FLINK-41106
> 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
>
>
> MapState.put_all() accepts a dictionary, but its process-mode implementation
> iterates the dictionary directly and attempts to unpack each key into a
> key/value pair.
> Reproduction 1, using integer keys:
> {code:python}
> state.put_all({2: 200})
> {code}
> Expected:
> The state contains 2 -> 200.
> Actual:
> TypeError: cannot unpack non-iterable int object.
> Reproduction 2, using string keys and values:
> {code:python}
> state.put_all({'ab': 'wanted'})
> state.get('ab') # None
> state.get('a') # 'b'
> {code}
> Expected:
> The state contains 'ab' -> 'wanted', with no unintended 'a' entry.
> Actual:
> The key 'ab' is unpacked into 'a' and 'b'; the supplied value is ignored.
> Root cause:
> InternalSynchronousMapRuntimeState.put_all() uses "for map_key, map_value in
> dict_value" instead of iterating dict_value.items().
> The affected implementation is in
> flink-python/pyflink/fn_execution/state_impl.py.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)