Skip to content

DDIR: sum integer values by key - #1102

Merged
frankmcsherry merged 1 commit into
TimelyDataflow:master-nextfrom
frankmcsherry:ddir-sum-int
Nov 20, 2026
Merged

frankmcsherry merged 1 commit into
TimelyDataflow:master-nextfrom
frankmcsherry:ddir-sum-int

Conversation

@frankmcsherry

Copy link
Copy Markdown
Member

Add a per-key sum for collections with integer values.

output "balance" = (deposits - debits) | sum;

Each update contributes its value times its signed diff. A nonzero total produces one row for the key. A zero total produces none, matching count.

The parser expands sum into lift, a join_function that moves the value into the diff, and count. The arrangement therefore holds unit values, and the lifted timestamp preserves all coordinates at any scope depth. The diff slot enforces the integer input type. sum remains available as a binding name.

Tests exercise signed values and diffs, cancellation and reappearance, incomparable root timestamps, nested scopes, and rejection of non-integer inputs.

Ran cargo test --no-fail-fast -p interactive -p ddir-server (396 passed, 9 ignored), round-tripped the printed balance plan with ddir-plan, and checked the balance example with one and three server workers.

@frankmcsherry
frankmcsherry merged commit 4a40c7c into TimelyDataflow:master-next Nov 20, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant