Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.15.0
Description
Suppose we declare a ValueState like following:
ValueStateDescriptor<Tuple2<Long, Long>> descriptor = new ValueStateDescriptor<>( "average", // the state name TypeInformation.of(new TypeHint<Tuple2<Long, Long>>() {}), Tuple2.of(0L, 0L));
and then we add state ttl config to the state:
descriptor.enableTimeToLive(StateTtlConfigUtil.createTtlConfig(60000));
the default value Tuple2.of(0L, 0L) will be invalid and may cause NPE.
I don't know if this is a bug cause I see @Deprecated in the comment of the ValueStateDescriptor constructor with argument defaultValue:
Use {@link #ValueStateDescriptor(String, TypeSerializer)} instead and manually * manage the default value by checking whether the contents of the state is {@code null}.
and if we decide not to use the defaultValue field in the class StateDescriptor, should we add @Deprecated annotation to the field defaultValue?
Attachments
Issue Links
- links to