'Can I read state in TumblingEventTimeWindows by state processor api?

I`m using flink datastream and TumblingEventTimeWindows on a long term window, can i read the data of the windowState in savespoint by state processor api in 1.9 release?

thanks.



Solution 1:[1]

Yes, that should be doable. You will need to have assigned a UID to the window operator in order to read its state from the savepoint, and you'll need to construct a compatible state descriptor, which should be something like

ListStateDescriptor<StreamRecord<T>> stateDesc =
    new ListStateDescriptor<>("window-contents", streamRecordSerializer);

Update: it seems that this does NOT entirely work at the moment, because the WindowOperator is using its window serializer as the namespace serializer, which means that the states in a TriggerContext can not be deserialized by the state processor API because it’s using a VoidNamespaceSerializer.

Further update: support for reading and writing window state has been added.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1