[Spark] Structured streaming runner: asynchronous cancel() should not report CANCELLED before the execution ended
- Dominant language
- Java
- Stars
- 8.7k
- Forks
- 4.7k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 196
Description
`SparkStructuredStreamingPipelineResult.cancel()` requests cancellation asynchronously and sets the state to CANCELLED at once. Per the `PipelineResult` contract the state should be observed: `getState()` queries the execution, `waitUntilFinish()` blocks until the pipeline is actually cancelled on the (mini) cluster, and only then the state becomes CANCELLED.
Changing this touches the shared `StructuredStreamingPipelineStateTest`, which asserts CANCELLED right after `cancel()` for the batch path today, and the legacy `SparkPipelineResult` has the same shape. Scope: `runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/SparkStructuredStreamingPipelineResult.java` and that test.
Follow up from #40103 / Part of #36841
Contributor guide
Research direction
Start with runners/spark/src/main/java/org/apache/beam/runners/spark/structuredstreaming/SparkStructuredStreamingPipelineResult.java and the shared StructuredStreamingPipelineStateTest. Trace how cancel(), getState(), and waitUntilFinish() observe execution on the mini cluster. Done means cancellation is reported only after execution has ended, with the test no longer expecting immediate CANCELLED for the batch path.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spark
- Domain
- stream-processing, testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100