-
Notifications
You must be signed in to change notification settings - Fork 28.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-50152][SS] Support handleInitialState with state data source r…
…eader ### What changes were proposed in this pull request? This PR adds support for users to provide a Dataframe that can be used to instantiate state for the query in the first batch for arbitrary state API v2. More specifically, this dataframe is coming from state data source reader. Remove the restraints that initialState dataframe can only contains one value row for a grouping key. This is to enable the integration with state data source reader. In flattened state data source reader for composite type, we will have multiple value rows mapping to the same grouping key. For example, we can union dataframe created by state data source reader on a single state variable and union them together and get an output dataframe as initial state for a transformWithState operator like this: ``` +-----------+-----+---------+----------+------------+ |groupingKey|value|listValue|userMapKey|userMapValue| +-----------+-----+---------+----------+------------+ |a |3 |NULL |NULL |NULL | |b |2 |NULL |NULL |NULL | |a |NULL |1 |NULL |NULL | |a |NULL |2 |NULL |NULL | |a |NULL |3 |NULL |NULL | |b |NULL |1 |NULL |NULL | |b |NULL |2 |NULL |NULL | |a |NULL |NULL |a |3 | |b |NULL |NULL |b |2 | +-----------+-----+---------+----------+------------+ ``` ### Why are the changes needed? This change is for supporting initial state handling for integration with state data source reader. ### Does this PR introduce _any_ user-facing change? No. The user API is the same as prior PR: #45467 for initial state support without state data source reader. ### How was this patch tested? Unit test cases added in `TransformWithStateWithInitialStateSuite`. ### Was this patch authored or co-authored using generative AI tooling? No. Closes #48686 from jingz-db/initial-state-reader-integration. Lead-authored-by: jingz-db <[email protected]> Co-authored-by: Jungtaek Lim <[email protected]> Signed-off-by: Jungtaek Lim <[email protected]>
- Loading branch information
1 parent
d96c623
commit 5432cef
Showing
5 changed files
with
257 additions
and
56 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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