[SPARK-55317] Add SequentialUnion logical plan node and planning rule #54098
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 changes were proposed in this pull request?
This PR introduces the SequentialUnion logical plan node, which enables sequential processing of multiple streaming sources. Unlike the existing Union operator that processes all children concurrently, SequentialUnion processes each child source to completion before moving to the next.
Key changes:
This is the foundational logical plan component. Execution support and user-facing APIs will be added in follow-up PRs.
Why are the changes needed?
Sequential Union enables backfill-to-live streaming scenarios where historical data must be processed completely before transitioning to live data, while preserving stateful operator state across the transition.
Example use case: Process historical Parquet data completely, then seamlessly switch to live Kafka streaming - all within a single query that maintains aggregations, watermarks, and deduplication state.
This pattern is not currently possible with the existing Union operator, which processes all sources concurrently.
Does this PR introduce any user-facing change?
No. This PR only adds the internal logical plan node. No user-facing APIs or behavior changes are introduced yet.
How was this patch tested?
Added new test suite SequentialUnionSuite with tests covering:
Was this patch authored or co-authored using generative AI tooling?
No