PDGGK opened a new pull request, #37530:
URL: https://github.com/apache/beam/pull/37530

   ## Summary
   
   This PR adds a warning when users declare `ValueState` with collection types 
(`Map`, `List`, `Set`) that could benefit from using specialized state types 
for better performance.
   
   **Problem:**
   When users store collections in `ValueState`, the entire collection must be 
read and written on each access. This can cause significant performance issues 
for large collections.
   
   **Solution:**
   Log a warning during pipeline construction suggesting:
   - `ValueState<Map>` → Use `MapState` instead
   - `ValueState<List>` → Use `BagState` or `OrderedListState` instead  
   - `ValueState<Set>` → Use `SetState` instead
   
   **Changes:**
   - `DoFnSignatures.java`: Added `warnIfValueStateContainsCollection()` method 
that inspects state declarations and logs warnings for collection types
   - `DoFnSignaturesTest.java`: Added test cases to verify the warning logic 
works correctly
   
   Fixes #36746
   
   ## Test plan
   
   - [x] Added tests for `ValueState<Map>`, `ValueState<List>`, 
`ValueState<Set>`
   - [x] Added test for simple `ValueState<String>` (no warning expected)
   - [ ] Existing tests should continue to pass
   
   ---
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


-- 
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