Skip to content

[Bug]: GenerateSequence Python SDK constructor does not support period parameter #35034

@jaymitdp

Description

@jaymitdp

What happened?

In the Apache Beam Python SDK, the GenerateSequence transform’s constructor does not accept the period parameter, even though the Java SDK requires it when elements_per_period is specified.

This means that if you want to use elements_per_period to generate a rate-limited sequence, you cannot specify the accompanying period through the Python SDK. This mismatch leads to a runtime failure inside the Java expansion service with the error:

RuntimeError: java.lang.IllegalArgumentException: elements per period specified, but no period specified
...

This prevents users from correctly controlling the rate of elements generated by GenerateSequence from Python, making elements_per_period unusable without period.

Steps to Reproduce

  1. In a Beam Python pipeline, attempt to instantiate GenerateSequence with elements_per_period set, e.g.:
GenerateSequence(start=0, elements_per_period=1)
  1. Notice that you cannot pass period to the constructor since it is not accepted as an argument.

  2. Run the pipeline on a runner using the expansion service (e.g., FlinkRunner).

  3. Observe the runtime error about missing period.

Expected Behavior

  • The Python SDK GenerateSequence constructor should support a period parameter.
  • This would allow users to specify elements_per_period and period, aligning with the Java SDK and the underlying runner’s requirements.

Actual Behavior

  • Python SDK constructor rejects period parameter (no support).
  • Pipeline fails at runtime with an IllegalArgumentException from the Java expansion service due to missing period.

Environment

  • Apache Beam Python SDK version: 2.65.0
  • Runner: FlinkRunner (with expansion service)
  • Java expansion service version: matches Beam 2.65.0

This gap between the Python SDK interface and the Java expansion service causes confusing runtime failures and limits the usability of GenerateSequence in Python for rate-limited sequences.

Issue Priority

Priority: 2 (default / most bugs 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: Samza Runner
  • Component: Twister2 Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions