[Bug]: [Python] DirectRunner Prism fallback to BundleBasedDirectRunner fails with NotImplementedError on batched DoFns (WriteToParquet)

Aperta
#41,078 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
48/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
python

Direzione di ricerca

Start in sdks/python/apache_beam/runners/direct/direct_runner.py, especially the SwitchingDirectRunner fallback around lines 141–146 and 204–230; compare its behavior with FnApiRunner for process_batch transforms. Reproduce with the provided WriteToParquet pipeline, then check relevant direct runner tests. Done means the fallback runs batched DoFns successfully without breaking the existing runner paths.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

awaiting triage bug P2 python
What happened?

When running a Python or Beam YAML pipeline with the default DirectRunner (SwitchingDirectRunner), if PrismRunner is bypassed (for example when the pipeline contains an external cross-language transform per direct_runner.py:141) or cannot start (offline environment / restricted container where the Prism binary cannot be downloaded or executed), SwitchingDirectRunner falls back to BundleBasedDirectRunner.

If the pipeline includes WriteToParquet (or any transform using DoFn.process_batch), execution then fails with NotImplementedError, even though the in-process FnApiRunner executes the exact same pipeline cleanly.

Minimal reproducer (forcing the non-Prism fallback path):

import tempfile, apache_beam as beam, pyarrow as pa

schema = pa.schema([('id', pa.int64()), ('name', pa.string())])
with tempfile.TemporaryDirectory() as d:
  with beam.Pipeline(runner='BundleBasedDirectRunner') as p:
    (p
     | beam.Create([{'id': 1, 'name': 'Ada'}])
     | beam.io.WriteToParquet(f'{d}/out', schema=schema))

Cause

In sdks/python/apache_beam/runners/direct/direct_runner.py (lines 141–146 and 204–230), SwitchingDirectRunner unconditionally falls back to BundleBasedDirectRunner(), which does not implement process_batch for batched PyArrow DoFns (FnApiRunner does). Checking for process_batch transforms (or routing batch pipelines without TestStream/unbounded state to FnApiRunner when Prism is unavailable) avoids the failure.

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: Prism Runner
  • Component: Hazelcast Jet Runner
  • Component: Google Cloud Dataflow Runner
Lingua principale
Java
Stelle
8.7k
Fork
4.8k
Merge medio
2g 12h
PR unite (30g)
371

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/beam

Tutte le issue di apache/beam

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.