Skip to content

mapStateful / mapStatefulConcat initialise state once per construction, not per run #352

Description

@Mendrejk

Problem

Flow.mapStateful and Flow.mapStatefulConcat call initializeState when the operator is constructed, then reuse that state for every subsequent execution. Repeated or partially consumed runs can therefore corrupt results.

Impact

Any operator built on these APIs, including linesUtf8, can leak framing or aggregation state across runs/cancellations.

Expected

Initialize state once per execution of the returned flow.

Suggested tests

  • Repeated full runs of a stateful flow produce identical results.
  • A cancelled/partial first run does not affect a second run.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions