dhruv-dagar opened a new pull request, #40398:
URL: https://github.com/apache/beam/pull/40398

   Fixes #40264
   
   ### What was changed?
   
   Updated `SparkStateInternals` so that `MapState` and `SetState` are cleared 
when their last element is removed.
   
   Previously, `remove()` wrote the resulting empty collection back to the 
state cell. Since `isEmpty()` determines emptiness based on whether the cell 
exists, this caused `isEmpty()` to incorrectly return `false` after removing 
the final element.
   
   This change:
   - Clears `MapState` when removing its last entry.
   - Clears `SetState` when removing its last element.
   - Adds regression tests to `StateInternalsTest` verifying that `isEmpty()` 
returns `true` after removing all elements individually.
   
   ### Testing
   Ran Locally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to