Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
1.6.0
-
Flink:1.6.0
Scala:2.11
JDK:1.8
Description
Thanks for the StateTtl feature,this is exactly what I need now! But I found an issue.
In the previous version or when StateTtl is not enabled,MapState allows `null` value,that means after
mapState.put("key", null)
, then
mapState.contains("key")
will return true, but when StateTtl is enabled,
mapState.contains("key")
will return false(the key has not expired).
So I think the field `userValue` in `org.apache.flink.runtime.state.ttl.TtlValue` should allow `null` value. User state is null may not means the TtlValue should be null.
/** * This class wraps user value of state with TTL. * * @param <T> Type of the user value of state with TTL */ class TtlValue<T> implements Serializable { private final T userValue; private final long lastAccessTimestamp; TtlValue(T userValue, long lastAccessTimestamp) { Preconditions.checkNotNull(userValue); this.userValue = userValue; this.lastAccessTimestamp = lastAccessTimestamp; } T getUserValue() { return userValue; } long getLastAccessTimestamp() { return lastAccessTimestamp; } }
Am I understanding right?
This is my test class.
StateWithTtlTest.scala StateWithOutTtlTest.scala
Thanks!
Attachments
Attachments
Issue Links
- is related to
-
FLINK-10374 [Map State] Let user value serializer handle null values
- Open
- links to