Dian Fu created FLINK-41103:
-------------------------------

             Summary: ValueState.update(None) attempts to serialize None 
instead of clearing the state
                 Key: FLINK-41103
                 URL: https://issues.apache.org/jira/browse/FLINK-41103
             Project: Flink
          Issue Type: Bug
          Components: API / Python
            Reporter: Dian Fu


The ValueState update contract specifies that a null value removes the current 
key's state. In PyFlink process mode, update(None) instead appends None to the 
underlying Beam bag after clearing it.

Reproduction using integer ValueState without TTL:
1. Write an integer value and complete a bundle.
2. Call state.update(None).
3. Complete the next bundle.

Expected:
The bundle completes successfully and subsequent reads return None.

Actual:
The bundle flush fails with "struct.error: required argument is not an integer" 
when the buffered None is serialized. Reading immediately after update(None) 
may appear correct because the pending local value is None.

Root cause:
SynchronousValueRuntimeState.update() unconditionally calls 
self._internal_state.add(value), including when value is None.

The affected implementation is in 
flink-python/pyflink/fn_execution/state_impl.py. The null case should clear the 
state without appending a value, while preserving the applicable flush policy.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to