[FLINK-40179] Support windowed states in state catalog - #29011
Open
gyfora wants to merge 3 commits into
Open
Conversation
…ties Adds the schema-extraction and catalog-table-building utilities needed to expose namespaced (e.g. window-scoped) keyed state: getWindowKeyedStateSchema, getWindowStateCatalogTable, and getFlattenedWindowStateCatalogTable in StateTableUtils, mirroring the plain keyed state utilities added previously. These are not yet wired into the catalog or table factory.
…d factories Wires namespaced (e.g. window-scoped) keyed state into the StateCatalog and SavepointDynamicTableSourceFactory: StateCatalog#getTable/tableName/ candidateTablesForOperator now handle StateReaderMode.WINDOWED/ WINDOWED_FLAT alongside the existing KEYED/KEYED_FLAT tables, and SavepointDynamicTableSourceFactory gains createWindowDynamicTableSource/ createFlattenedWindowDynamicTableSource dispatch. Adds the supporting implementation: WindowStateTableMapping, WindowFlattenedStateTableMapping, WindowKeyedStateReader, WindowFlattenedKeyedStateReader, WindowSavepointDataStreamScanProvider, WindowFlattenedSavepointDataStreamScanProvider, WindowKeyedStateReaderFunction, WindowKeyedStateReaderOperator, and MultiStateKeyAndNamespaceIterator, plus SavepointReader#readWindowKeyedState for programmatic access to namespaced keyed state. Non-keyed/operator state support (LIST/UNION/BROADCAST) is deferred to a later commit.
Adds StateCatalogWindowITCase covering read access to namespaced (e.g. window-scoped) keyed state through the StateCatalog, including the flattened LIST/MAP variant. Fixes SavepointEnvironment#getTaskInfo to cap the reported numberOfParallelSubtasks at the being-read operator's maxParallelism: the wrapping read job's own parallelism is unrelated to the source operator's savepoint maxParallelism and may exceed it (e.g. a windowAll()/forceNonParallel() operator has maxParallelism == 1), which otherwise violates TaskInfoImpl's invariant that maxParallelism >= numberOfParallelSubtasks.
Collaborator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What is the purpose of the change
This is the second part of the code contribution for the FLIP-599 State Catalog
The StateCatalog can already expose plain keyed state from a savepoint as queryable tables. This PR extends that support to namespaced keyed state — most commonly window state — so state kept per (key, window) pair can also be discovered and queried as a table through the StateCatalog, instead of only being reachable via the lower-level SavepointReader API.
Brief change log
utilities for plain keyed state.
Verifying this change
catalog discovery and SQL reads for the new tables.
Does this pull request potentially affect one of the following parts:
@Public(Evolving):noDocumentation
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Sonnet 5