[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[jira] [Created] (FLINK-10157) The TTL state not allow `null` state value

chengjie.wu created FLINK-10157:

             Summary: The TTL state not allow `null` state value
                 Key: FLINK-10157
                 URL: https://issues.apache.org/jira/browse/FLINK-10157
             Project: Flink
          Issue Type: Bug
          Components: State Backends, Checkpointing
    Affects Versions: 1.6.0
         Environment: Flink:1.6.0


            Reporter: chengjie.wu
         Attachments: StateWithOutTtlTest.scala, StateWithTtlTest.scala

In the previous version or when StateTtl is not enabled,MapState allows `null` value,that means after
mapState.put("key", null){code}
, then
will return {color:#FF0000}*true*{color}, but when StateTtl is enabled,
will return {color:#FF0000}*false*{color}(*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) {
 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]


This message was sent by Atlassian JIRA