[Feature Request]: [Python/YAML] Add native Expect / data quality PTransform with tagged DLQ outputs

Offen
#41,223 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Feature
Klarheit
Größtenteils klar
Aktivitätsstatus
Aktiv
Tech-Stack
python, yaml

Rechercherichtung

Start by reading the Python transform patterns in apache_beam.transforms and the Beam YAML transform registration and configuration paths. Then check how schema-aware transforms, tagged outputs, and standard Beam metrics are implemented. The issue describes the required rules and violation actions; done means the native transform and YAML registration support them with the requested main and DLQ outputs and metrics.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Description

In production data pipelines (e.g. Bronze -> Silver -> Gold), validating records against declarative data quality rules is a fundamental requirement.
Currently in Apache Beam, implementing validation requires writing custom multi-output DoFns and branching logic. In Beam YAML, there is no declarative way to specify data quality rules with automated quarantine actions.

Proposed Architecture

Add an Expect Schema-Aware PTransform in apache_beam.transforms.expect (and register type: Expect in Beam YAML):

pipeline:
  transforms:
    - type: ReadFromCsv
      config: {path: 'gs://bucket/raw/*.csv'}
    - type: Expect
      config:
        rules:
          - name: positive_amount
            expression: 'amount > 0.0'
            on_violation: dlq
          - name: non_null_customer
            expression: 'customer_id IS NOT NULL'
            on_violation: fail
          - name: valid_email
            expression: "email LIKE '%@%'"
            on_violation: drop
        dlq_output: InvalidRecords
    - type: WriteToParquet
      input: Expect
      config: {path: 'gs://bucket/silver/'}
    - type: WriteToJson
      input: Expect.InvalidRecords
      config: {path: 'gs://bucket/dlq/'}
Key Capabilities
  1. Tagged Outputs: Emits Tag("main") for passed records and Tag("dlq") for quarantined records.
  2. Standard Beam Metrics: Emits beam:metric:user:expectation_passed:{rule} and expectation_quarantined:{rule} for real-time monitoring on Dataflow/Flink.
  3. Pluggable Violation Actions: dlq, drop, or fail (aborts worker).
Vorherrschende Sprache
Java
Sterne
8.7k
Forks
4.8k
Ø Merge
2 T. 12 Std.
Gemergte PRs (30 T.)
371

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus apache/beam

Alle Issues in apache/beam

Ähnliche Issues

Weitere Issues zu Java

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.