feat(dfir_pipes): add push accum operators (fold, reduce, etc)#2962
Open
MingweiSamuel wants to merge 1 commit into
Open
feat(dfir_pipes): add push accum operators (fold, reduce, etc)#2962MingweiSamuel wants to merge 1 commit into
MingweiSamuel wants to merge 1 commit into
Conversation
Deploying hydro with
|
| Latest commit: |
28fd95e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://0b87d585.hydroflow.pages.dev |
| Branch Preview URL: | https://mingwei-push-pipes.hydroflow.pages.dev |
MingweiSamuel
added a commit
that referenced
this pull request
Jun 19, 2026
735733a to
ffbe2bd
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends dfir_pipes’ push-operator toolbox by introducing accumulator-style combinators (fold/reduce/sort) plus keyed accumulation operators, and updates compile-fail expectations in dfir_rs accordingly.
Changes:
- Add a unified
Accumulatepush combinator driven by anAccumStatetrait, with providedFoldState,ReduceState, andSortStateimplementations. - Add new push combinators:
Sort,FoldKeyed, andReduceKeyed, and expose constructors/exports frompush::mod. - Update
dfir_rscompile-fail.stderrsnapshots to reflect newPushimplementors shown by the compiler.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| dfir_rs/tests/compile-fail/stable/surface_demuxenum_wrongfields_2.stderr | Snapshot update to reflect additional Push implementors in error output. |
| dfir_rs/tests/compile-fail/stable/surface_demuxenum_wrongfields_1.stderr | Snapshot update to reflect additional Push implementors in error output. |
| dfir_rs/tests/compile-fail/stable/surface_demuxenum_wrongenum.stderr | Snapshot update to reflect additional Push implementors in error output. |
| dfir_pipes/src/push/accumulate.rs | Introduces the Accumulate combinator and AccumState trait; includes unit tests. |
| dfir_pipes/src/push/accum_state.rs | Adds concrete accumulator states for fold/reduce/sort behaviors. |
| dfir_pipes/src/push/fold_keyed.rs | Adds keyed fold accumulation into a HashMap and emit-on-finalize behavior. |
| dfir_pipes/src/push/reduce_keyed.rs | Adds keyed reduce accumulation into a HashMap and emit-on-finalize behavior. |
| dfir_pipes/src/push/sort.rs | Adds a Sort push combinator emitting sorted items on finalize. |
| dfir_pipes/src/push/mod.rs | Wires new modules/exports and adds constructors (fold, reduce, reduce_ref, accumulate, sort). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+137
to
+146
| if let AccumPhase::Draining(iter) = this.phase { | ||
| loop { | ||
| ready!(this.next.as_mut().poll_ready(ctx)); | ||
| let Some(item) = iter.next() else { | ||
| break; | ||
| }; | ||
| this.next.as_mut().start_send(item, ()); | ||
| } | ||
| *this.phase = AccumPhase::Done; | ||
| } |
Comment on lines
+357
to
+359
| /// Creates a reduce push (owned mode) that reduces all items into a single value, | ||
| /// then emits it downstream on finalize. If no items were received, nothing is emitted. | ||
| pub const fn reduce<ReduceFn, Next, Item>( |
Comment on lines
+13
to
+15
| /// Push combinator that folds items by key into a hashmap, then emits all | ||
| /// (key, accumulator) pairs downstream on flush. | ||
| /// |
Comment on lines
+13
to
+15
| /// Push combinator that reduces items by key into a hashmap, then emits all | ||
| /// (key, value) pairs downstream on flush. The first value for each key | ||
| /// becomes the initial accumulator. |
ffbe2bd to
2d4ab7c
Compare
2d4ab7c to
28fd95e
Compare
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.
No description provided.