forked from apache/spark
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SPARK-49131][SS] TransformWithState should properly set implicit gro…
…uping keys even with lazy iterators ### What changes were proposed in this pull request? These changes ensure that implicit grouping key thread locals are set in two places: 1. When `handleInputRows` is called. This allows for the user to get/set keyed state in the body of `handleInputRows` before they create the iterator that they return (see the UT). 2. When methods on the returned iterator from `handleInputRows` are called. ### Why are the changes needed? Previously, if `handleInputRows` returned a lazy iterator, then the following would happen: 1. The implicit grouping key was set in `processNewData` 2. `handleInputRows` ran, and returned an iterator, call it `iter` 3. The implicit grouping key was unset 4. When the sink finally causes the iterator to evaluate, the iterator from `handleInputRows` is invoked, but cannot find the implicit grouping key ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? - New UT. - The new UT was verified to fail on current `master`. - All existing UTs should pass. ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#47641 from neilramaswamy/spark-49131. Authored-by: Neil Ramaswamy <neil.ramaswamy@databricks.com> Signed-off-by: Jungtaek Lim <kabhwan.opensource@gmail.com>
- Loading branch information
1 parent
a6a62e5
commit 5d2d6a3
Showing
2 changed files
with
126 additions
and
5 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