Tzu-Li (Gordon) Tai created FLINK-16311:
-------------------------------------------
Summary: PersistedAppendingBuffer state primitive has incorrect contracts for view() method
Key: FLINK-16311
URL:
https://issues.apache.org/jira/browse/FLINK-16311 Project: Flink
Issue Type: Bug
Components: Stateful Functions
Affects Versions: statefun-1.1
Reporter: Tzu-Li (Gordon) Tai
Assignee: Tzu-Li (Gordon) Tai
The {{PersistedAppendingBuffer}} state primitive in Stateful Functions, states that {{view()}} returns {{null}} if the buffer wasn't accessed before, or after a {{clear()}}.
This actually is not possible. The {{PersistedAppendingBuffer}} primitive is based on Flink's {{ListState}} state handle, which always returns an empty list if the elements of the list is empty, and never a {{null}}.
This means that the {{PersistedAppendingBuffer}} won't be able to differentiate the cases (e.g. if the state wasn't accessed or cleared v.s. an empty buffer).
We suggest to just change the contract so that {{PersistedAppendingBuffer#view()}} follows the behavior of Flink's {{ListState}} to never return null.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)