#1390 - configurable storage for aggregating functions#2473
Open
MrHDOLEK wants to merge 1 commit into
Open
Conversation
GroupBy aggregation can move state out of the PHP heap instead of holding every result in memory. A new AggregationStorage abstraction offers three backends: memory (default, unchanged behavior), filesystem spill+merge, and PSR-16 key-value (APCu/Redis). - MergeableAggregatingFunction + merge() on all built-in aggregators - AggregationStorage: Memory / External (filesystem spill+merge) / Kv (PSR-16) - KV storage fails loudly on eviction / write failure instead of returning a wrong aggregate - config: AggregationStorageStrategy + FLOW_AGGREGATION_MAX_MEMORY wired into ConfigBuilder - APCu enabled in the nix dev shell (for the PSR-16/APCu storage test)
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## 1.x #2473 +/- ##
============================================
- Coverage 85.12% 83.48% -1.65%
+ Complexity 21300 658 -20642
============================================
Files 1608 1627 +19
Lines 65717 67042 +1325
============================================
+ Hits 55944 55969 +25
- Misses 9773 11073 +1300 🚀 New features to boost your workflow:
|
norberttech
reviewed
Jun 22, 2026
| */ | ||
| public function __construct( | ||
| public array $values, | ||
| public array $aggregators, |
Member
There was a problem hiding this comment.
I'm not really sure if I understand this data structure, it's keeping values for all aggregators?
norberttech
reviewed
Jun 22, 2026
| return $this; | ||
| } | ||
|
|
||
| public function aggregationStorage(AggregationStorageStrategy $strategy): self |
norberttech
reviewed
Jun 22, 2026
| return $this; | ||
| } | ||
|
|
||
| public function aggregationStore(AggregationStorage $storage): self |
Member
There was a problem hiding this comment.
Those two methods, aggregationStorage and aggregationStore are a bit confusing
norberttech
reviewed
Jun 22, 2026
|
|
||
| public function flush(): void; | ||
|
|
||
| public function save(string $hash, GroupEntry $entry): void; |
Member
There was a problem hiding this comment.
what's the difference between entry and save?
norberttech
reviewed
Jun 22, 2026
|
|
||
| namespace Flow\ETL\Function; | ||
|
|
||
| interface MergeableAggregatingFunction extends AggregatingFunction |
Member
There was a problem hiding this comment.
could you walk me through this logic? Like when two AggregatingFunctions can be merged?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
GroupBy aggregation can move state out of the PHP heap instead of holding every result in memory. A new AggregationStorage abstraction offers three backends: memory (default,
unchanged behavior), filesystem spill+merge, and PSR-16 key-value (APCu/Redis).
Resolves: #1390
Change Log
Added
AggregationStorageabstraction with three backends: in-memory (default), filesystem spill+merge, and PSR-16 key-value (APCu/Redis).ConfigBuilderaggregation settings:aggregationStorage(),aggregationMemoryLimit(),aggregationFilesystem(),aggregationStore(), theAggregationStorageStrategyenum and theFLOW_AGGREGATION_MAX_MEMORYenvironment variable.MergeableAggregatingFunctioninterface withmerge()implemented by all built-in aggregating functions, allowing spilled partial aggregates to be merged.Fixed
Changed
Removed
Deprecated
Security