[
https://issues.apache.org/jira/browse/FLINK-30048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Lijie Wang updated FLINK-30048:
-------------------------------
Component/s: Runtime / State Backends
> MapState.remove(UK key) is better to return the old value.
> ----------------------------------------------------------
>
> Key: FLINK-30048
> URL: https://issues.apache.org/jira/browse/FLINK-30048
> Project: Flink
> Issue Type: Improvement
> Components: API / DataStream, Runtime / State Backends
> Reporter: xljtswf
> Priority: Major
>
> Hi all:
> I found the MapState.remove(UK key) just returns nothing, and the Java Map
> Interface returns the old value associated with the key.
> Consider the flollowing example from the Learn Flink Event-driven Application
> [链接标题|https://nightlies.apache.org/flink/flink-docs-release-1.16/docs/learn-flink/event_driven/#the-ontimer-method]
> ,
> we want to get the value with the timestamp and then delete the timestamp,
> with current inplement, we must first call mapState.get(key),then call
> mapState.remove(key). it will search the key 2 times, I think it is not
> necessary. If mapState.remove(key) can return the old value, then we can just
> call mapState.remove(key) and get the old value and save the unnecessary 2nd
> search in the map.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)