Skip to main content

8. Global Pipeline TotalizerEasy

Aggregations & Grouping⏱️ ~10 mins

8. Global Pipeline Totalizer

Enterprise Architecture Context

In production stream-processing architectures (Google Cloud Dataflow / Flink), pipeline stages must handle parallel transformations without data loss, managing schema mutations and aggregations across distributed worker workers.

Problem Statement

### Business Context Financial end-of-day settlement pipelines sum transaction records across thousands of branch ledgers into a single reconciliation balance. ### Problem Statement Write a function `sum_pcollection(input_pcoll)` that totals all numeric elements in a PCollection into a single scalar sum using `beam.CombineGlobally(sum)`.

Key Learning Objectives

  • Understand distributed Apache Beam execution DAG stages and pipeline lifecycle.
  • Apply idiomatic functional Python transforms using the pipe operator |.
  • Ensure data consistency and idempotency across distributed stream workers.

Sample Data Fixtures

Sample Example 1
Input Stream:
[10, 20, 30]
Expected Output:
60
Sample Example 2
Input Stream:
[-10, 5, 5]
Expected Output:
0
Topics:#CombineGlobally#Aggregations
Support