Skip to content

[Feature Request]: Support stateful ParDo, timers and @RequiresTimeSortedInput in the Spark Structured Streaming batch runner #39779

Description

@f-loris

What would you like to happen?

The Spark Structured Streaming (Dataset-based) runner currently rejects any DoFn that uses state, uses timers, or is annotated with @RequiresTimeSortedInput. ParDoTranslatorBatch.canTranslate fails with "States and timers are not supported for the moment", so the entire state and timer surface of the Beam model is unavailable on this runner.

The classic RDD-based Spark runner supports batch stateful ParDo, so this is a capability gap between the two Spark runners rather than a limitation of Spark.

Proposal

Translate stateful / timer / time-sorted ParDo via KeyValueGroupedDataset#flatMapSortedGroups, grouping by key and ordering each group by event time, then drive the DoFn per key with InMemoryStateInternals and InMemoryTimerInternals from runners-core.

Because batch has no state store to bridge onto — state is a heap object scoped to one key — every Beam state type is already implemented by InMemoryStateInternals, so the state categories above can be enabled together rather than incrementally.

Additional (tagged) outputs for stateful ParDo should be in scope for this issue.

Issue Priority

Priority: 2 (default / most feature requests should be filed as P2)

Issue Components

  • Component: Python SDK
  • Component: Java SDK
  • Component: Go SDK
  • Component: Typescript SDK
  • Component: IO connector
  • Component: Beam YAML
  • Component: Beam examples
  • Component: Beam playground
  • Component: Beam katas
  • Component: Website
  • Component: Infrastructure
  • Component: Spark Runner
  • Component: Flink Runner
  • Component: Prism Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions