Re: [Question] How to maintain cross-window state

2025-05-15 Thread Shaochen Bai
Interesting suggestion. Are you proposing that we transform our original windowing strategy into a global window + OrderedListState +timer? Then the state can indeed persist throughout the entire execution. The only problem left I think is that the state would be lost whenever we cancel and redeplo

Re: [Question] How to maintain cross-window state

2025-05-06 Thread Kenneth Knowles
It does sound to me like your use case may be a good fit for using DoFn with state. I realize now that RequiresTimeSortedInput may not be supported for the configuration. As a workaround, you can use OrderedListState to buffer elements and then process them in order using a timer to "wake up" your

Re: [Question] How to maintain cross-window state

2025-05-06 Thread Shaochen Bai
Hello, Our objective is to maintain a persistent, time-relevant state per key. What we do now is that we use non-overlapping windows and apply GroupByKey.create() to gather an array of windowed data for each key. We then sort the data by timestamp and iterate through the array to update the asso

Re: [Question] How to maintain cross-window state

2025-05-05 Thread Kenneth Knowles
Hello! This is not possible in a simple way, because of the main fact: windows are processed simultaneously. Many windows may have some state and incoming data at the same time, even if the time ranges of your windows do not overlap. So, sharing state across windows would need concurrency control

[Question] How to maintain cross-window state

2025-05-02 Thread Shaochen Bai
Hello, I read that in stateful processing with Apache Beam, *“a state cell is scoped to a key+window pair.”* What if I want to maintain a persistent state *across* windows? Is there a workaround for this, and what are the common practices in such