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 15:33:33 UTC

[GitHub] azagrebin commented on a change in pull request #6707: [FLINK-10157] [State TTL] Allow `null` user values in map state with TTL

azagrebin 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_r218853515
 
 

 ##########
 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:
   I added it for code reuse because `get` and `contains` needed the same code.

----------------------------------------------------------------
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