Skip to content

[WIP][NEED-HUMAN-REVIEW] Support Multiple Stateful Operators in Update Mode#55250

Closed
HeartSaVioR wants to merge 2 commits intoapache:masterfrom
HeartSaVioR:WIP-multi-stateful-update-mode
Closed

[WIP][NEED-HUMAN-REVIEW] Support Multiple Stateful Operators in Update Mode#55250
HeartSaVioR wants to merge 2 commits intoapache:masterfrom
HeartSaVioR:WIP-multi-stateful-update-mode

Conversation

@HeartSaVioR
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Why are the changes needed?

Does this PR introduce any user-facing change?

How was this patch tested?

Was this patch authored or co-authored using generative AI tooling?

…without aggregation

When a streaming query does not contain a streaming aggregation, Update mode
is equivalent to Append mode. This means multiple stateful operators should be
supported in Update mode as well, as long as there is no streaming aggregation.

Previously, `Deduplicate` without event-time columns was not counted as a
stateful operation in `isStatefulOperation`, which was an exception allowing
some multi-stateful-op patterns to work in Update mode for the wrong reason.
This change removes that exception and properly classifies all `Deduplicate`
as stateful operations, which is consistent with their physical execution.

The existing `ifCannotBeFollowedByStatefulOperation` +
`checkStreamingQueryGlobalWatermarkLimit` logic already correctly handles the
validation: non-aggregation stateful operators are not flagged, so they can
freely chain with each other in any output mode.
…ator position in Update mode

Placing streaming aggregation as the last stateful operator (closest to the
sink) in Update mode enables early firing from aggregation combined with
multiple stateful operators upstream -- a benefit that Append mode cannot
provide. If streaming aggregation is NOT at the last stateful operator
position, it remains disallowed in Update mode.

The existing `ifCannotBeFollowedByStatefulOperation` logic already correctly
handles this: Aggregate in non-Append mode is flagged, so it fails when it
appears as a descendant of another stateful operator. When Aggregate is at
the root (last), no stateful ancestor exists, so the check passes.

This commit adds unit tests in UnsupportedOperationsSuite mirroring the
existing Append mode coverage, and integration tests in
MultiStatefulOperatorsSuite verifying the end-to-end behavior.
@HeartSaVioR HeartSaVioR self-assigned this Apr 7, 2026
@dongjoon-hyun dongjoon-hyun marked this pull request as draft April 8, 2026 15:51
@HeartSaVioR HeartSaVioR closed this Apr 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant