You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2018/09/19 08:15:56 UTC
[GitHub] Clarkkkkk commented on a change in pull request #6707:
[FLINK-10157] [State TTL] Allow `null` user values in map state with TTL
Clarkkkkk commented on a change in pull request #6707: [FLINK-10157] [State TTL] Allow `null` user values in map state with TTL
URL: https://github.com/apache/flink/pull/6707#discussion_r218707661
##########
File path: flink-runtime/src/main/java/org/apache/flink/runtime/state/ttl/TtlMapState.java
##########
@@ -54,7 +54,13 @@
@Override
public UV get(UK key) throws Exception {
- return getWithTtlCheckAndUpdate(() -> original.get(key), v -> original.put(key, v), () -> original.remove(key));
+ TtlValue<UV> ttlValue = getWrapped(key);
+ return ttlValue == null ? null : ttlValue.getUserValue();
+ }
+
+ private TtlValue<UV> getWrapped(UK key) throws Exception {
+ return getWrappedWithTtlCheckAndUpdate(
+ () -> original.get(key), v -> original.put(key, v), () -> original.remove(key));
Review comment:
Is it necessary to add a private method here?
TtlValue<UV> ttlValue = getWrappedWithTtlCheckAndUpdate(
() -> original.get(key), v -> original.put(key, v), () -> original.remove(key));
return ttlValue == null ? null : ttlValue.getUserValue();
looks better to me.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services