From 5af317f43ee37480f83045889f7af52b42cc98b8 Mon Sep 17 00:00:00 2001 From: Rohit Kulshreshtha Date: Thu, 19 Dec 2024 21:17:37 -0800 Subject: [PATCH] chore: Renamed hydroflow_datalog -> dfir_datalog. --- .github/workflows/release.yml | 2 +- CONTRIBUTING.md | 4 +- Cargo.lock | 28 +- Cargo.toml | 2 +- RELEASING.md | 14 +- .../CHANGELOG.md | 0 .../Cargo.toml | 4 +- .../src/lib.rs | 0 ...egations_and_comments@datalog_program.snap | 1136 +++++++ ...gregations_and_comments@surface_graph.snap | 41 + ...tions_fold_keyed_expr@datalog_program.snap | 429 +++ ...gations_fold_keyed_expr@surface_graph.snap | 18 + ...ore__tests__anti_join@datalog_program.snap | 1049 ++++++ ..._core__tests__anti_join@surface_graph.snap | 40 + ...e__tests__collect_vec@datalog_program.snap | 766 +++++ ...ore__tests__collect_vec@surface_graph.snap | 30 + ..._core__tests__detuple@datalog_program.snap | 353 ++ ...og_core__tests__detuple@surface_graph.snap | 18 + ...ts__detuple_then_flat@datalog_program.snap | 437 +++ ...ests__detuple_then_flat@surface_graph.snap | 22 + ...core__tests__expr_lhs@datalog_program.snap | 896 +++++ ...g_core__tests__expr_lhs@surface_graph.snap | 45 + ...tests__expr_predicate@datalog_program.snap | 835 +++++ ...__tests__expr_predicate@surface_graph.snap | 43 + ...ts__flat_then_detuple@datalog_program.snap | 392 +++ ...ests__flat_then_detuple@surface_graph.snap | 20 + ..._core__tests__flatten@datalog_program.snap | 357 ++ ...og_core__tests__flatten@surface_graph.snap | 18 + ...og_core__tests__index@datalog_program.snap | 2250 +++++++++++++ ...alog_core__tests__index@surface_graph.snap | 88 + ...ests__join_with_other@datalog_program.snap | 638 ++++ ..._tests__join_with_other@surface_graph.snap | 28 + ...tests__join_with_self@datalog_program.snap | 600 ++++ ...__tests__join_with_self@surface_graph.snap | 27 + ...__local_constraints@datalog_program-2.snap | 354 ++ ...ts__local_constraints@datalog_program.snap | 348 ++ ...ts__local_constraints@surface_graph-2.snap | 18 + ...ests__local_constraints@surface_graph.snap | 18 + ...alog_core__tests__max@datalog_program.snap | 429 +++ ...atalog_core__tests__max@surface_graph.snap | 18 + ..._core__tests__max_all@datalog_program.snap | 438 +++ ...og_core__tests__max_all@surface_graph.snap | 18 + ...ests__minimal_program@datalog_program.snap | 315 ++ ..._tests__minimal_program@surface_graph.snap | 16 + ..._tests__multi_detuple@datalog_program.snap | 402 +++ ...e__tests__multi_detuple@surface_graph.snap | 20 + ...multiple_contributors@datalog_program.snap | 547 +++ ...__multiple_contributors@surface_graph.snap | 26 + ...s__non_copy_but_clone@datalog_program.snap | 315 ++ ...sts__non_copy_but_clone@surface_graph.snap | 16 + ..._core__tests__persist@datalog_program.snap | 2996 +++++++++++++++++ ...og_core__tests__persist@surface_graph.snap | 114 + ...s__persist_uniqueness@datalog_program.snap | 824 +++++ ...sts__persist_uniqueness@surface_graph.snap | 31 + ...__tests__send_to_node@datalog_program.snap | 517 +++ ...re__tests__send_to_node@surface_graph.snap | 23 + ..._tests__simple_filter@datalog_program.snap | 349 ++ ...e__tests__simple_filter@surface_graph.snap | 18 + ...single_column_program@datalog_program.snap | 638 ++++ ...__single_column_program@surface_graph.snap | 28 + ...s__transitive_closure@datalog_program.snap | 803 +++++ ...sts__transitive_closure@surface_graph.snap | 37 + ..._triple_relation_join@datalog_program.snap | 970 ++++++ ...s__triple_relation_join@surface_graph.snap | 40 + ...ests__wildcard_fields@datalog_program.snap | 601 ++++ ..._tests__wildcard_fields@surface_graph.snap | 27 + ...__wildcard_join_count@datalog_program.snap | 1434 ++++++++ ...ts__wildcard_join_count@surface_graph.snap | 53 + hydro_deploy/hydro_cli_examples/Cargo.toml | 2 +- .../examples/dedalus_2pc_coordinator/main.rs | 2 +- .../examples/dedalus_2pc_participant/main.rs | 2 +- .../examples/dedalus_receiver/main.rs | 2 +- .../examples/dedalus_sender/main.rs | 2 +- .../examples/dedalus_vote_leader/main.rs | 2 +- .../examples/dedalus_vote_participant/main.rs | 2 +- hydroflow/Cargo.toml | 6 +- hydroflow/src/lib.rs | 4 +- topolotree/Cargo.toml | 2 +- 78 files changed, 23417 insertions(+), 40 deletions(-) rename {hydroflow_datalog => dfir_datalog}/CHANGELOG.md (100%) rename {hydroflow_datalog => dfir_datalog}/Cargo.toml (88%) rename {hydroflow_datalog => dfir_datalog}/src/lib.rs (100%) create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program-2.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph-2.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@surface_graph.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@datalog_program.snap create mode 100644 dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@surface_graph.snap diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 95aa12549023..38f29675fbc7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -87,7 +87,7 @@ jobs: --bump ${{ inputs.bump }} --bump-dependencies auto ${{ inputs.execute && '--execute' || '--no-publish' }} hydroflow hydroflow_lang dfir_macro hydroflow_plus - hydroflow_plus_std hydroflow_datalog dfir_datalog_core + hydroflow_plus_std dfir_datalog dfir_datalog_core hydro_deploy hydro_cli hydroflow_deploy_integration stageleft stageleft_macro stageleft_tool multiplatform_test diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72e68172e9d0..71b2824c7f7f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -14,7 +14,7 @@ Relative to the repository root: layer" while the surface syntax compiler is the "compiled layer". * `hydro_lang` and related (hydro_*) packages contain Hydro, which is a functional syntax built on top of `hydroflow`. -* `hydroflow_datalog` provides a datalog compiler, based on top of the Hydroflow surface syntax. +* `dfir_datalog` provides a datalog compiler, based on top of the Hydroflow surface syntax. * `docs` is the [Hydro.run](https://hydro.run/) website. `website_playground` contains the playground portion of the website, used for compiling Hydroflow in-browser via WASM. * `benches` contains some microbenchmarks for Hydroflow and other frameworks. @@ -33,7 +33,7 @@ There are auxillary repositories as well: * [`hydro-project/rust-sitter`](https://github.com/hydro-project/rust-sitter) provides a [Tree-sitter](https://tree-sitter.github.io/tree-sitter/)-based parser generator interface, used - by `hydroflow_datalog`. + by `dfir_datalog`. ## Rust diff --git a/Cargo.lock b/Cargo.lock index b87f1af63bd2..be7b6dd3b9bf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -871,6 +871,17 @@ dependencies = [ "powerfmt", ] +[[package]] +name = "dfir_datalog" +version = "0.10.0" +dependencies = [ + "dfir_datalog_core", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.75", +] + [[package]] name = "dfir_datalog_core" version = "0.10.0" @@ -1446,9 +1457,9 @@ dependencies = [ name = "hydro_cli_examples" version = "0.0.0" dependencies = [ + "dfir_datalog", "futures", "hydroflow", - "hydroflow_datalog", "rand", "serde", "serde_json", @@ -1582,10 +1593,10 @@ dependencies = [ "clap", "colored", "criterion", + "dfir_datalog", "dfir_macro", "futures", "getrandom", - "hydroflow_datalog", "hydroflow_deploy_integration", "hydroflow_lang", "insta", @@ -1618,17 +1629,6 @@ dependencies = [ "zipf", ] -[[package]] -name = "hydroflow_datalog" -version = "0.10.0" -dependencies = [ - "dfir_datalog_core", - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.75", -] - [[package]] name = "hydroflow_deploy_integration" version = "0.10.0" @@ -3788,9 +3788,9 @@ dependencies = [ name = "topolotree" version = "0.0.0" dependencies = [ + "dfir_datalog", "futures", "hydroflow", - "hydroflow_datalog", "procinfo", "rand", "serde", diff --git a/Cargo.toml b/Cargo.toml index 0941748fae19..1b1b39ae8877 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ members = [ "hydro_deploy/hydro_cli_examples", "hydro_deploy/hydroflow_deploy_integration", "hydroflow", - "hydroflow_datalog", + "dfir_datalog", "dfir_datalog_core", "hydroflow_lang", "dfir_macro", diff --git a/RELEASING.md b/RELEASING.md index 7430630fd0d9..22b55cca2e97 100644 --- a/RELEASING.md +++ b/RELEASING.md @@ -29,7 +29,7 @@ cargo smart-release --update-crates-index \ --no-changelog-preview --allow-fully-generated-changelogs \ --bump-dependencies auto --bump minor \ # or `patch`, `major`, `keep`, `auto` hydroflow hydroflow_lang dfir_macro hydro_lang \ - hydroflow_datalog dfir_datalog_core \ + dfir_datalog dfir_datalog_core \ hydro_deploy hydro_cli hydroflow_cli_integration \ hydroflow_plus_cli_integration \ stageleft stageleft_macro stageleft_tool \ @@ -62,18 +62,18 @@ showing that all the changelogs can be modified. Make sure the version bumps loo [INFO ] Will not publish or alter 3 dependent crates: unchanged = 'hydroflow_deploy_integration', 'variadics', 'pusherator' [INFO ] WOULD auto-bump dependent package 'hydroflow_lang' from 0.4.0 to 0.5.0 for publishing [INFO ] WOULD auto-bump dependent package 'dfir_datalog_core' from 0.4.0 to 0.5.0 for publishing, for SAFETY due to breaking package 'hydroflow_lang' -[INFO ] WOULD auto-bump dependent package 'hydroflow_datalog' from 0.4.0 to 0.5.0 for publishing, for SAFETY due to breaking package 'dfir_datalog_core' +[INFO ] WOULD auto-bump dependent package 'dfir_datalog' from 0.4.0 to 0.5.0 for publishing, for SAFETY due to breaking package 'dfir_datalog_core' [INFO ] WOULD auto-bump dependent package 'hydroflow_macro' from 0.4.0 to 0.5.0 for publishing, for SAFETY due to breaking package 'hydroflow_lang' [INFO ] WOULD auto-bump dependent package 'lattices' from 0.4.0 to 0.5.0 for publishing -[INFO ] WOULD minor-bump provided package 'hydroflow' from 0.4.0 to 0.5.0 for publishing, for SAFETY due to breaking package 'hydroflow_datalog' +[INFO ] WOULD minor-bump provided package 'hydroflow' from 0.4.0 to 0.5.0 for publishing, for SAFETY due to breaking package 'dfir_datalog' [INFO ] WOULD minor-bump provided package 'hydro_cli' from 0.4.0 to 0.5.0 for publishing [INFO ] WOULD adjust 2 manifest versions due to breaking change in 'hydroflow_lang': 'dfir_datalog_core' 0.4.0 ➡ 0.5.0, 'hydroflow_macro' 0.4.0 ➡ 0.5.0 -[INFO ] WOULD adjust 1 manifest version due to breaking change in 'dfir_datalog_core': 'hydroflow_datalog' 0.4.0 ➡ 0.5.0 -[INFO ] WOULD adjust 1 manifest version due to breaking change in 'hydroflow_datalog': 'hydroflow' 0.4.0 ➡ 0.5.0 +[INFO ] WOULD adjust 1 manifest version due to breaking change in 'dfir_datalog_core': 'dfir_datalog' 0.4.0 ➡ 0.5.0 +[INFO ] WOULD adjust 1 manifest version due to breaking change in 'dfir_datalog': 'hydroflow' 0.4.0 ➡ 0.5.0 [INFO ] WOULD adjust version constraints in manifests of 2 packages as direct dependencies are changing: relalg, website_playground [INFO ] WOULD modify existing changelog for 'hydroflow_lang'. [INFO ] WOULD modify existing changelog for 'dfir_datalog_core'. -[INFO ] WOULD modify existing changelog for 'hydroflow_datalog'. +[INFO ] WOULD modify existing changelog for 'dfir_datalog'. [INFO ] WOULD modify existing changelog for 'hydroflow_macro'. [INFO ] WOULD modify existing changelog for 'lattices'. [INFO ] WOULD modify existing changelog for 'hydroflow'. @@ -85,7 +85,7 @@ showing that all the changelogs can be modified. Make sure the version bumps loo If the job does not succeed or succeeds but fails to generate changelogs for certain packages, then you will need to do a bit of manual work. That looks like this in the log (check for this!): ```log -[WARN ] WOULD ask for review after commit as the changelog entry is empty for crates: hydroflow_datalog, hydroflow_macro +[WARN ] WOULD ask for review after commit as the changelog entry is empty for crates: dfir_datalog, hydroflow_macro ``` In this case, you will need to create a commit to each package's `CHANGELOG.md` to mark it as unchanged (or minimally changed). For example, [hydro_datalog 0.4](https://github.com/hydro-project/hydroflow/commit/5faee64ab82eeb7a24f62a1b55c46d72d8eb5320) diff --git a/hydroflow_datalog/CHANGELOG.md b/dfir_datalog/CHANGELOG.md similarity index 100% rename from hydroflow_datalog/CHANGELOG.md rename to dfir_datalog/CHANGELOG.md diff --git a/hydroflow_datalog/Cargo.toml b/dfir_datalog/Cargo.toml similarity index 88% rename from hydroflow_datalog/Cargo.toml rename to dfir_datalog/Cargo.toml index 08adec182770..5f4ff294842e 100644 --- a/hydroflow_datalog/Cargo.toml +++ b/dfir_datalog/Cargo.toml @@ -1,10 +1,10 @@ [package] -name = "hydroflow_datalog" +name = "dfir_datalog" publish = true version = "0.10.0" edition = "2021" license = "Apache-2.0" -documentation = "https://docs.rs/hydroflow_datalog/" +documentation = "https://docs.rs/dfir_datalog/" description = "Datalog proc-macro for Hydroflow" [lints] diff --git a/hydroflow_datalog/src/lib.rs b/dfir_datalog/src/lib.rs similarity index 100% rename from hydroflow_datalog/src/lib.rs rename to dfir_datalog/src/lib.rs diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@datalog_program.snap new file mode 100644 index 000000000000..6e6227b694c3 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@datalog_program.snap @@ -0,0 +1,1136 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"union ()\"},\"version\":1},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result2 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 ,) , ((row . 0) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () . 1 , g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 ,) , (row . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev + val . 0) } else { Some (val . 0) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () , g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 ,) , (row . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev) } else { Some (val . 0) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () , g . 0 ,))\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1},{\"value\":{\"Operator\":\"identity ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":24,\"version\":1}],\"version\":5},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":3},{\"idx\":14,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":1,\"version\":3},{\"idx\":17,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":9,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":7,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":1,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":3},{\"idx\":18,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":22,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":23,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":23,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":25,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":25,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"2\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":6,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":4,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":22,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1},{\"value\":2,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":\"ints\",\"version\":1},{\"value\":\"result_insert\",\"version\":1},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result2_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":false,\"version\":1}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_1v3_send, hoff_1v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(1v3)"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_7v3_send, hoff_7v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(7v3)"); + let (hoff_9v3_send, hoff_9v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(9v3)"); + let (hoff_23v1_send, hoff_23v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(23v1)"); + let (hoff_25v1_send, hoff_25v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(25v1)"); + let mut sg_5v1_node_10v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_5v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_14v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_2v1_node_21v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + let sg_2v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_17v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(5v1)", + 0, + var_expr!(), + var_expr!(hoff_1v3_send, hoff_9v3_send, hoff_23v1_send), + false, + move | + context, + var_args!(), + var_args!(hoff_1v3_send, hoff_9v3_send, hoff_23v1_send)| + { + let hoff_1v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_1v3_send.give(Some(v)); + }); + let hoff_9v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_9v3_send.give(Some(v)); + }); + let hoff_23v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_23v1_send.give(Some(v)); + }); + let op_10v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_5v1_node_10v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__source_stream__loc_nopath_3_25_3_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__source_stream__loc_nopath_3_25_3_44(op_10v1) + }; + let op_2v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_5v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_3_19_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_3_19_3_23(op_2v1) + }; + let op_20v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.1,), (row.0,)), + hoff_23v1_send, + ); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_20v1__map__loc_nopath_1_0_1_0(op_20v1) + }; + let op_16v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.1,), (row.0,)), + hoff_1v3_send, + ); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_16v1__map__loc_nopath_1_0_1_0(op_16v1) + }; + let op_13v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.1,), ((row.0),)), + hoff_9v3_send, + ); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + op_13v1, + hydroflow::pusherator::tee::Tee::new(op_16v1, op_20v1), + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_3_19_3_23< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_3_19_3_23(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_5v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_5v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 1, + var_expr!(hoff_9v3_recv, hoff_25v1_recv), + var_expr!(), + false, + move |context, var_args!(hoff_9v3_recv, hoff_25v1_recv), var_args!()| { + let mut hoff_9v3_recv = hoff_9v3_recv.borrow_mut_swap(); + let hoff_9v3_recv = hoff_9v3_recv.drain(..); + let mut hoff_25v1_recv = hoff_25v1_recv.borrow_mut_swap(); + let hoff_25v1_recv = hoff_25v1_recv.drain(..); + let mut sg_1v1_node_14v1_hashtable = context + .state_ref(sg_1v1_node_14v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_9v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_1v1_node_14v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some({ + let prev: (hydroflow::rustc_hash::FxHashSet<_>, _) = prev; + let mut set: hydroflow::rustc_hash::FxHashSet<_> = prev.0; + if set.insert(val.0) { + (set, prev.1 + 1) + } else { + (set, prev.1) + } + }) + } else { + Some({ + let mut set = hydroflow::rustc_hash::FxHashSet::< + _, + >::default(); + set.insert(val.0); + (set, 1) + }) + }; + }, + ); + } + } + let op_14v1 = sg_1v1_node_14v1_hashtable.drain(); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__fold_keyed__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_14v1.map(|(g, a): ((_,), _)| (a.0.unwrap().1, g.0)); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_1_0_1_0(op_15v1) + }; + let op_19v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_25v1_recv) + }; + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__defer_tick__loc_nopath_8_30_8_32< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__defer_tick__loc_nopath_8_30_8_32(op_19v1) + }; + let op_4v1 = { + #[allow(unused)] + #[inline(always)] + fn check_inputs< + A: ::std::iter::Iterator, + B: ::std::iter::Iterator, + Item, + >(a: A, b: B) -> impl ::std::iter::Iterator { + a.chain(b) + } + check_inputs(op_15v1, op_19v1) + }; + let op_4v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_4v1__union__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_4v1__union__loc_nopath_4_20_4_26(op_4v1) + }; + let op_5v1 = op_4v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_11v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_11v1__for_each__loc_nopath_4_28_4_65(op_11v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_11v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 1, + var_expr!(hoff_23v1_recv), + var_expr!(), + false, + move |context, var_args!(hoff_23v1_recv), var_args!()| { + let mut hoff_23v1_recv = hoff_23v1_recv.borrow_mut_swap(); + let hoff_23v1_recv = hoff_23v1_recv.drain(..); + let mut sg_2v1_node_21v1_hashtable = context + .state_ref(sg_2v1_node_21v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_23v1_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_2v1_node_21v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some(prev) + } else { + Some(val.0) + }; + }, + ); + } + } + let op_21v1 = sg_2v1_node_21v1_hashtable.drain(); + let op_21v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_21v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_21v1__fold_keyed__loc_nopath_1_0_1_0(op_21v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_22v1 = op_21v1.map(|(g, a): ((_,), _)| (a.0.unwrap(), g.0)); + let op_22v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_22v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_22v1__map__loc_nopath_1_0_1_0(op_22v1) + }; + let op_8v1 = op_22v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_5_20_5_27< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_5_20_5_27(op_8v1) + }; + let op_12v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result2.send(v).unwrap() + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__for_each__loc_nopath_5_29_5_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__for_each__loc_nopath_5_29_5_67(op_12v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_8v1, op_12v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(3v1)", + 1, + var_expr!(hoff_1v3_recv), + var_expr!(hoff_7v3_send), + false, + move |context, var_args!(hoff_1v3_recv), var_args!(hoff_7v3_send)| { + let mut hoff_1v3_recv = hoff_1v3_recv.borrow_mut_swap(); + let hoff_1v3_recv = hoff_1v3_recv.drain(..); + let hoff_7v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_7v3_send.give(Some(v)); + }); + let mut sg_3v1_node_17v1_hashtable = context + .state_ref(sg_3v1_node_17v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_1v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_3v1_node_17v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some(prev + val.0) + } else { + Some(val.0) + }; + }, + ); + } + } + let op_17v1 = sg_3v1_node_17v1_hashtable.drain(); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__fold_keyed__loc_nopath_1_0_1_0(op_17v1) + }; + #[inline(always)] + fn pivot_run_sg_3v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_3v1(op_17v1, hoff_7v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(4v1)", + 1, + var_expr!(hoff_7v3_recv), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(hoff_7v3_recv), var_args!(hoff_6v3_send)| { + let mut hoff_7v3_recv = hoff_7v3_recv.borrow_mut_swap(); + let hoff_7v3_recv = hoff_7v3_recv.drain(..); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = hoff_7v3_recv + .map(|(g, a): ((_,), _)| (a.0.unwrap(), g.0)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_1_0_1_0(op_18v1) + }; + #[inline(always)] + fn pivot_run_sg_4v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_4v1(op_18v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(6v1)", + 2, + var_expr!(hoff_6v3_recv), + var_expr!(hoff_25v1_send), + false, + move |context, var_args!(hoff_6v3_recv), var_args!(hoff_25v1_send)| { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let hoff_25v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_25v1_send.give(Some(v)); + }); + let op_24v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_6v3_recv) + }; + let op_24v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_24v1__identity__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_24v1__identity__loc_nopath_1_0_1_0(op_24v1) + }; + #[inline(always)] + fn pivot_run_sg_6v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_6v1(op_24v1, hoff_25v1_send); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@surface_graph.snap new file mode 100644 index 000000000000..ecf12f46d17e --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_and_comments@surface_graph.snap @@ -0,0 +1,41 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +4v1 = union (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +10v1 = source_stream (ints); +11v1 = for_each (| v | result . send (v) . unwrap ()); +12v1 = for_each (| v | result2 . send (v) . unwrap ()); +13v1 = map (| row : (_ , _ ,) | ((row . 1 ,) , ((row . 0) ,))); +14v1 = fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; }); +15v1 = map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () . 1 , g . 0 ,)); +16v1 = map (| row : (_ , _ ,) | ((row . 1 ,) , (row . 0 ,))); +17v1 = fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev + val . 0) } else { Some (val . 0) } ; }); +18v1 = map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () , g . 0 ,)); +19v1 = defer_tick (); +20v1 = map (| row : (_ , _ ,) | ((row . 1 ,) , (row . 0 ,))); +21v1 = fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev) } else { Some (val . 0) } ; }); +22v1 = map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () , g . 0 ,)); + +10v1 -> 2v1; +2v1 -> 3v1; +4v1 -> 5v1; +22v1 -> 8v1; +5v1 -> 11v1; +8v1 -> 12v1; +15v1 -> 4v1; +14v1 -> 15v1; +13v1 -> 14v1; +3v1 -> 13v1; +19v1 -> 4v1; +18v1 -> 19v1; +17v1 -> 18v1; +16v1 -> 17v1; +3v1 -> 16v1; +21v1 -> 22v1; +20v1 -> 21v1; +3v1 -> 20v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@datalog_program.snap new file mode 100644 index 000000000000..d70b84c9bdf8 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@datalog_program.snap @@ -0,0 +1,429 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 % 2 ,) , (row . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev + val . 0) } else { Some (val . 0) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 , a . 0 . unwrap () ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let mut sg_2v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_2v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_10v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_6v3_send)| { + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_25_2_44(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1.map(|row: (_, _)| ((row.0 % 2,), (row.1,))); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_1_0_1_0(op_9v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_9v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 1, + var_expr!(hoff_6v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_6v3_recv), var_args!()| { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut sg_1v1_node_10v1_hashtable = context + .state_ref(sg_1v1_node_10v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_6v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_1v1_node_10v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some(prev + val.0) + } else { + Some(val.0) + }; + }, + ); + } + } + let op_10v1 = sg_1v1_node_10v1_hashtable.drain(); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__fold_keyed__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_,), _)| (g.0, a.0.unwrap())); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@surface_graph.snap new file mode 100644 index 000000000000..15f9204b4f0f --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__aggregations_fold_keyed_expr@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row : (_ , _ ,) | ((row . 0 % 2 ,) , (row . 1 ,))); +10v1 = fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev + val . 0) } else { Some (val . 0) } ; }); +11v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 , a . 0 . unwrap () ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +10v1 -> 11v1; +9v1 -> 10v1; +2v1 -> 9v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@datalog_program.snap new file mode 100644 index 000000000000..eed00f58b001 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@datalog_program.snap @@ -0,0 +1,1049 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints_1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints_2)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints_3)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ((_ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 1 ,) , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"anti_join ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , (_ , _ ,)) | (kv . 0 . 0 , kv . 1 . 0 , kv . 1 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ , _ ,) | ((_v . 0 ,) , (_v . 1 , _v . 2 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (_v . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ , _ ,) | ((row . 1 , row . 2 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":9,\"version\":3}],\"version\":5},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":5},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":3},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":26,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":3},{\"idx\":21,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":22,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":23,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":23,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":12,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":25,\"version\":1},{\"idx\":26,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":25,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":23,\"version\":1},{\"idx\":21,\"version\":1},{\"idx\":22,\"version\":1},{\"idx\":25,\"version\":1},{\"idx\":26,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_3_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_4\",\"version\":1},{\"value\":\"join_4\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_9v3_send, hoff_9v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(9v3)"); + let (hoff_12v3_send, hoff_12v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(12v3)"); + let mut sg_2v1_node_15v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints_3) + }; + let sg_2v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_3v1_node_13v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints_1) + }; + let mut sg_4v1_node_14v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints_2) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_17v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_17v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_17v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_17v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_21v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_21v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_11v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_12v3_send), + false, + move |context, var_args!(), var_args!(hoff_12v3_send)| { + let hoff_12v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_12v3_send.give(Some(v)); + }); + let op_15v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_15v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__source_stream__loc_nopath_4_27_4_48< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__source_stream__loc_nopath_4_27_4_48(op_15v1) + }; + let op_8v1 = op_15v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_4_19_4_25< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_4_19_4_25(op_8v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_24v1 = op_8v1.map(|_v: (_,)| (_v.0,)); + let op_24v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_24v1__map__loc_nopath_7_57_7_66< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_24v1__map__loc_nopath_7_57_7_66(op_24v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_24v1, hoff_12v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(3v1)", + 0, + var_expr!(), + var_expr!(hoff_9v3_send), + false, + move |context, var_args!(), var_args!(hoff_9v3_send)| { + let hoff_9v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_9v3_send.give(Some(v)); + }); + let op_13v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_3v1_node_13v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__source_stream__loc_nopath_2_27_2_48< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__source_stream__loc_nopath_2_27_2_48(op_13v1) + }; + #[inline(always)] + fn pivot_run_sg_3v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_3v1(op_13v1, hoff_9v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(4v1)", + 0, + var_expr!(), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_6v3_send)| { + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_14v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_4v1_node_14v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__source_stream__loc_nopath_3_27_3_48< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__source_stream__loc_nopath_3_27_3_48(op_14v1) + }; + #[inline(always)] + fn pivot_run_sg_4v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_4v1(op_14v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 1, + var_expr!(hoff_6v3_recv, hoff_9v3_recv, hoff_12v3_recv), + var_expr!(), + false, + move | + context, + var_args!(hoff_6v3_recv, hoff_9v3_recv, hoff_12v3_recv), + var_args!()| + { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut hoff_9v3_recv = hoff_9v3_recv.borrow_mut_swap(); + let hoff_9v3_recv = hoff_9v3_recv.drain(..); + let mut hoff_12v3_recv = hoff_12v3_recv.borrow_mut_swap(); + let hoff_12v3_recv = hoff_12v3_recv.drain(..); + let op_2v1 = hoff_9v3_recv + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_25< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_25(op_2v1) + }; + let op_5v1 = hoff_6v3_recv + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_25< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_25(op_5v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = op_2v1.map(|_v: (_, _)| ((_v.1,), (_v.0,))); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_7_28_7_40< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_7_28_7_40(op_19v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_20v1 = op_5v1.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_7_42_7_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__map__loc_nopath_7_42_7_54(op_20v1) + }; + let mut sg_1v1_node_17v1_joindata_lhs_borrow = context + .state_ref(sg_1v1_node_17v1_joindata_lhs) + .borrow_mut(); + let mut sg_1v1_node_17v1_joindata_rhs_borrow = context + .state_ref(sg_1v1_node_17v1_joindata_rhs) + .borrow_mut(); + let op_17v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_19v1, + op_20v1, + &mut *sg_1v1_node_17v1_joindata_lhs_borrow, + &mut *sg_1v1_node_17v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__join__loc_nopath_7_12_7_66< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__join__loc_nopath_7_12_7_66(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1 + .map(|kv: ((_,), ((_,), (_,)))| (kv.0.0, kv.1.0.0, kv.1.1.0)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_7_12_7_66< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_7_12_7_66(op_18v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_23v1 = op_18v1.map(|_v: (_, _, _)| ((_v.0,), (_v.1, _v.2))); + let op_23v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_23v1__map__loc_nopath_7_28_7_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_23v1__map__loc_nopath_7_28_7_54(op_23v1) + }; + let mut sg_1v1_node_21v1_antijoindata_neg_borrow = context + .state_ref(sg_1v1_node_21v1_antijoindata_neg) + .borrow_mut(); + let mut sg_1v1_node_21v1_antijoindata_pos_borrow = context + .state_ref(sg_1v1_node_21v1_antijoindata_pos) + .borrow_mut(); + let op_21v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_12v3_recv, + op_23v1, + &mut *sg_1v1_node_21v1_antijoindata_neg_borrow + .get_mut_clear(context.current_tick()), + &mut *sg_1v1_node_21v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_21v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_21v1__anti_join__loc_nopath_7_12_7_66< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_21v1__anti_join__loc_nopath_7_12_7_66(op_21v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_22v1 = op_21v1 + .map(|kv: ((_,), (_, _))| (kv.0.0, kv.1.0, kv.1.1)); + let op_22v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_22v1__map__loc_nopath_7_12_7_66< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_22v1__map__loc_nopath_7_12_7_66(op_22v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_25v1 = op_22v1.map(|row: (_, _, _)| ((row.1, row.2), ())); + let op_25v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_25v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_25v1__map__loc_nopath_1_0_1_0(op_25v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_26v1 = op_25v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_26v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_26v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_26v1__map__loc_nopath_1_0_1_0(op_26v1) + }; + let op_11v1 = op_26v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_11v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__unique__loc_nopath_5_20_5_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__unique__loc_nopath_5_20_5_26(op_11v1) + }; + let op_16v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__for_each__loc_nopath_5_28_5_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_16v1__for_each__loc_nopath_5_28_5_65(op_16v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_11v1, op_16v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@surface_graph.snap new file mode 100644 index 000000000000..033ca1cf572a --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__anti_join@surface_graph.snap @@ -0,0 +1,40 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +11v1 = unique :: < 'tick > (); +13v1 = source_stream (ints_1); +14v1 = source_stream (ints_2); +15v1 = source_stream (ints_3); +16v1 = for_each (| v | result . send (v) . unwrap ()); +17v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +18v1 = map (| kv : ((_ ,) , ((_ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,)); +19v1 = map (| _v : (_ , _ ,) | ((_v . 1 ,) , (_v . 0 ,))); +20v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +21v1 = anti_join (); +22v1 = map (| kv : ((_ ,) , (_ , _ ,)) | (kv . 0 . 0 , kv . 1 . 0 , kv . 1 . 1 ,)); +23v1 = map (| _v : (_ , _ , _ ,) | ((_v . 0 ,) , (_v . 1 , _v . 2 ,))); +24v1 = map (| _v : (_ ,) | (_v . 0 ,)); +25v1 = map (| row : (_ , _ , _ ,) | ((row . 1 , row . 2 ,) , ())); +26v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +13v1 -> 2v1; +14v1 -> 5v1; +15v1 -> 8v1; +26v1 -> 11v1; +11v1 -> 16v1; +17v1 -> 18v1; +19v1 -> 17v1; +2v1 -> 19v1; +20v1 -> 17v1; +5v1 -> 20v1; +21v1 -> 22v1; +23v1 -> 21v1; +18v1 -> 23v1; +24v1 -> 21v1; +8v1 -> 24v1; +25v1 -> 26v1; +22v1 -> 25v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@datalog_program.snap new file mode 100644 index 000000000000..e84a86da4748 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@datalog_program.snap @@ -0,0 +1,766 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints2)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : (() , ((_ ,) , (_ ,))) | (kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (() , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (() , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | (() , ((row . 0 , row . 1) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev ; set . insert (val . 0) ; set }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; set }) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : (() , _) | (a . 0 . unwrap () . into_iter () . collect :: < Vec < _ > > () ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":3},{\"idx\":18,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":9,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_9v3_send, hoff_9v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(9v3)"); + let mut sg_2v1_node_10v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_2v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_2v1_node_11v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints2) + }; + let sg_2v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_2v1_node_13v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_2v1_node_13v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_2v1_node_13v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_2v1_node_13v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_18v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(), (Option<_>,)>::default(), + ), + ); + let sg_1v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_9v3_send), + false, + move |context, var_args!(), var_args!(hoff_9v3_send)| { + let hoff_9v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_9v3_send.give(Some(v)); + }); + let op_10v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_10v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__source_stream__loc_nopath_2_26_2_46(op_10v1) + }; + let op_2v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_11v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_11v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__source_stream__loc_nopath_3_26_3_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__source_stream__loc_nopath_3_26_3_46(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_24(op_5v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_2v1.map(|_v: (_,)| ((), (_v.0,))); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_7_41_7_49< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_7_41_7_49(op_15v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = op_5v1.map(|_v: (_,)| ((), (_v.0,))); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_7_51_7_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_7_51_7_59(op_16v1) + }; + let mut sg_2v1_node_13v1_joindata_lhs_borrow = context + .state_ref(sg_2v1_node_13v1_joindata_lhs) + .borrow_mut(); + let mut sg_2v1_node_13v1_joindata_rhs_borrow = context + .state_ref(sg_2v1_node_13v1_joindata_rhs) + .borrow_mut(); + let op_13v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_15v1, + op_16v1, + &mut *sg_2v1_node_13v1_joindata_lhs_borrow, + &mut *sg_2v1_node_13v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__join__loc_nopath_7_12_7_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__join__loc_nopath_7_12_7_59(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1 + .map(|kv: ((), ((_,), (_,)))| (kv.1.0.0, kv.1.1.0)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_7_12_7_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_7_12_7_59(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_17v1 = op_14v1.map(|row: (_, _)| ((), ((row.0, row.1),))); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__map__loc_nopath_1_0_1_0(op_17v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_17v1, hoff_9v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 1, + var_expr!(hoff_9v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_9v3_recv), var_args!()| { + let mut hoff_9v3_recv = hoff_9v3_recv.borrow_mut_swap(); + let hoff_9v3_recv = hoff_9v3_recv.drain(..); + let mut sg_1v1_node_18v1_hashtable = context + .state_ref(sg_1v1_node_18v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_9v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_1v1_node_18v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some({ + let mut set: hydroflow::rustc_hash::FxHashSet<_> = prev; + set.insert(val.0); + set + }) + } else { + Some({ + let mut set = hydroflow::rustc_hash::FxHashSet::< + _, + >::default(); + set.insert(val.0); + set + }) + }; + }, + ); + } + } + let op_18v1 = sg_1v1_node_18v1_hashtable.drain(); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__fold_keyed__loc_nopath_1_0_1_0(op_18v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = op_18v1 + .map(|(g, a): ((), _)| ( + a.0.unwrap().into_iter().collect::>(), + )); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_1_0_1_0(op_19v1) + }; + let op_8v1 = op_19v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_5_20_5_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_5_20_5_26(op_8v1) + }; + let op_12v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__for_each__loc_nopath_5_28_5_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__for_each__loc_nopath_5_28_5_65(op_12v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_8v1, op_12v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@surface_graph.snap new file mode 100644 index 000000000000..dadacd2d8f15 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__collect_vec@surface_graph.snap @@ -0,0 +1,30 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +10v1 = source_stream (ints1); +11v1 = source_stream (ints2); +12v1 = for_each (| v | result . send (v) . unwrap ()); +13v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +14v1 = map (| kv : (() , ((_ ,) , (_ ,))) | (kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,)); +15v1 = map (| _v : (_ ,) | (() , (_v . 0 ,))); +16v1 = map (| _v : (_ ,) | (() , (_v . 0 ,))); +17v1 = map (| row : (_ , _ ,) | (() , ((row . 0 , row . 1) ,))); +18v1 = fold_keyed :: < 'tick , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev ; set . insert (val . 0) ; set }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; set }) } ; }); +19v1 = map (| (g , a) : (() , _) | (a . 0 . unwrap () . into_iter () . collect :: < Vec < _ > > () ,)); + +10v1 -> 2v1; +11v1 -> 5v1; +19v1 -> 8v1; +8v1 -> 12v1; +13v1 -> 14v1; +15v1 -> 13v1; +2v1 -> 15v1; +16v1 -> 13v1; +5v1 -> 16v1; +18v1 -> 19v1; +17v1 -> 18v1; +14v1 -> 17v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@datalog_program.snap new file mode 100644 index 000000000000..51e4b3e611a9 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@datalog_program.snap @@ -0,0 +1,353 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row_untuple : (_ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1 + .map(|row_untuple: (_,)| (row_untuple.0.0, row_untuple.0.1)); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_6_12_6_41< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_6_12_6_41(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_4_28_4_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@surface_graph.snap new file mode 100644 index 000000000000..63f7aeef3bfb --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints1); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row_untuple : (_ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 ,)); +10v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +11v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +2v1 -> 9v1; +10v1 -> 11v1; +9v1 -> 10v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@datalog_program.snap new file mode 100644 index 000000000000..0663e5bb61f4 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@datalog_program.snap @@ -0,0 +1,437 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row_untuple : (_ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"flat_map (| row : (_ , _ ,) | row . 0 . into_iter () . map (move | __flattened_element | (__flattened_element , :: std :: clone :: Clone :: clone (& row . 1) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"flat_map (| row : (_ , _ ,) | row . 1 . into_iter () . map (move | __flattened_element | (:: std :: clone :: Clone :: clone (& row . 0) , __flattened_element ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1},{\"value\":\"source_reader_0\",\"version\":1},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1 + .map(|row_untuple: (_,)| (row_untuple.0.0, row_untuple.0.1)); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_6_12_6_43< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_6_12_6_43(op_9v1) + }; + let op_10v1 = op_9v1 + .flat_map(|row: (_, _)| { + row + .0 + .into_iter() + .map(move |__flattened_element| ( + __flattened_element, + ::std::clone::Clone::clone(&row.1), + )) + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__flat_map__loc_nopath_6_12_6_43< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__flat_map__loc_nopath_6_12_6_43(op_10v1) + }; + let op_11v1 = op_10v1 + .flat_map(|row: (_, _)| { + row + .1 + .into_iter() + .map(move |__flattened_element| ( + ::std::clone::Clone::clone(&row.0), + __flattened_element, + )) + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__flat_map__loc_nopath_6_12_6_43< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__flat_map__loc_nopath_6_12_6_43(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_12v1 = op_11v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__map__loc_nopath_1_0_1_0(op_12v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = op_12v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + let op_5v1 = op_13v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_4_28_4_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@surface_graph.snap new file mode 100644 index 000000000000..46d445f2f28a --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__detuple_then_flat@surface_graph.snap @@ -0,0 +1,22 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints1); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row_untuple : (_ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 ,)); +10v1 = flat_map (| row : (_ , _ ,) | row . 0 . into_iter () . map (move | __flattened_element | (__flattened_element , :: std :: clone :: Clone :: clone (& row . 1) ,))); +11v1 = flat_map (| row : (_ , _ ,) | row . 1 . into_iter () . map (move | __flattened_element | (:: std :: clone :: Clone :: clone (& row . 0) , __flattened_element ,))); +12v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +13v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +13v1 -> 5v1; +5v1 -> 8v1; +10v1 -> 11v1; +9v1 -> 10v1; +2v1 -> 9v1; +12v1 -> 13v1; +11v1 -> 12v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@datalog_program.snap new file mode 100644 index 000000000000..8ac59a220209 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@datalog_program.snap @@ -0,0 +1,896 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"union ()\"},\"version\":1},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((123 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 + 123 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 . clone () + row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((123 - row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((123 % (row . 0 + 5) ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 * 5 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":1,\"version\":3},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":1,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":22,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":23,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":23,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"2\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"2\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"3\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"3\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"4\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"4\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"5\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"5\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1},{\"idx\":4,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":\"ints\",\"version\":1},{\"value\":\"result_insert\",\"version\":1},{\"value\":\"result_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_1v3_send, hoff_1v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(1v3)"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_21v1_send, hoff_21v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(21v1)"); + let (hoff_22v1_send, hoff_22v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(22v1)"); + let (hoff_23v1_send, hoff_23v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(23v1)"); + let (hoff_24v1_send, hoff_24v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(24v1)"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_2v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!( + hoff_1v3_send, hoff_6v3_send, hoff_21v1_send, hoff_22v1_send, + hoff_23v1_send, hoff_24v1_send + ), + false, + move | + context, + var_args!(), + var_args!( + hoff_1v3_send, hoff_6v3_send, hoff_21v1_send, hoff_22v1_send, + hoff_23v1_send, hoff_24v1_send + )| + { + let hoff_1v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_1v3_send.give(Some(v)); + }); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let hoff_21v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_21v1_send.give(Some(v)); + }); + let hoff_22v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_22v1_send.give(Some(v)); + }); + let hoff_23v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_23v1_send.give(Some(v)); + }); + let hoff_24v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_24v1_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_25_2_44(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + hoff_6v3_send, + hydroflow::pusherator::tee::Tee::new( + hoff_1v3_send, + hydroflow::pusherator::tee::Tee::new( + hoff_21v1_send, + hydroflow::pusherator::tee::Tee::new( + hoff_22v1_send, + hydroflow::pusherator::tee::Tee::new( + hoff_23v1_send, + hoff_24v1_send, + ), + ), + ), + ), + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_2_19_2_23< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_2_19_2_23(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!( + hoff_1v3_recv, hoff_6v3_recv, hoff_21v1_recv, hoff_22v1_recv, + hoff_23v1_recv, hoff_24v1_recv + ), + var_expr!(), + false, + move | + context, + var_args!( + hoff_1v3_recv, hoff_6v3_recv, hoff_21v1_recv, hoff_22v1_recv, + hoff_23v1_recv, hoff_24v1_recv + ), + var_args!()| + { + let mut hoff_1v3_recv = hoff_1v3_recv.borrow_mut_swap(); + let hoff_1v3_recv = hoff_1v3_recv.drain(..); + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut hoff_21v1_recv = hoff_21v1_recv.borrow_mut_swap(); + let hoff_21v1_recv = hoff_21v1_recv.drain(..); + let mut hoff_22v1_recv = hoff_22v1_recv.borrow_mut_swap(); + let hoff_22v1_recv = hoff_22v1_recv.drain(..); + let mut hoff_23v1_recv = hoff_23v1_recv.borrow_mut_swap(); + let hoff_23v1_recv = hoff_23v1_recv.drain(..); + let mut hoff_24v1_recv = hoff_24v1_recv.borrow_mut_swap(); + let hoff_24v1_recv = hoff_24v1_recv.drain(..); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = hoff_6v3_recv.map(|row: (_,)| ((123,), ())); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_1_0_1_0(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = hoff_1v3_recv.map(|row: (_,)| ((row.0 + 123,), ())); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_12v1 = op_11v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__map__loc_nopath_1_0_1_0(op_12v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = hoff_21v1_recv + .map(|row: (_,)| ((row.0.clone() + row.0,), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = hoff_22v1_recv.map(|row: (_,)| ((123 - row.0,), ())); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_1_0_1_0(op_15v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = op_15v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_1_0_1_0(op_16v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_17v1 = hoff_23v1_recv + .map(|row: (_,)| ((123 % (row.0 + 5),), ())); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__map__loc_nopath_1_0_1_0(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_1_0_1_0(op_18v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = hoff_24v1_recv.map(|row: (_,)| ((row.0 * 5,), ())); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_1_0_1_0(op_19v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_20v1 = op_19v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__map__loc_nopath_1_0_1_0(op_20v1) + }; + let op_4v1 = { + #[allow(unused)] + #[inline(always)] + fn check_inputs< + A: ::std::iter::Iterator, + B: ::std::iter::Iterator, + Item, + >(a: A, b: B) -> impl ::std::iter::Iterator { + a.chain(b) + } + check_inputs( + check_inputs( + check_inputs( + check_inputs(check_inputs(op_10v1, op_12v1), op_14v1), + op_16v1, + ), + op_18v1, + ), + op_20v1, + ) + }; + let op_4v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_4v1__union__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_4v1__union__loc_nopath_3_20_3_26(op_4v1) + }; + let op_5v1 = op_4v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@surface_graph.snap new file mode 100644 index 000000000000..1ba6a240a163 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_lhs@surface_graph.snap @@ -0,0 +1,45 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +4v1 = union (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row : (_ ,) | ((123 ,) , ())); +10v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +11v1 = map (| row : (_ ,) | ((row . 0 + 123 ,) , ())); +12v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +13v1 = map (| row : (_ ,) | ((row . 0 . clone () + row . 0 ,) , ())); +14v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +15v1 = map (| row : (_ ,) | ((123 - row . 0 ,) , ())); +16v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +17v1 = map (| row : (_ ,) | ((123 % (row . 0 + 5) ,) , ())); +18v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +19v1 = map (| row : (_ ,) | ((row . 0 * 5 ,) , ())); +20v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); + +7v1 -> 2v1; +2v1 -> 3v1; +4v1 -> 5v1; +5v1 -> 8v1; +10v1 -> 4v1; +9v1 -> 10v1; +3v1 -> 9v1; +12v1 -> 4v1; +11v1 -> 12v1; +3v1 -> 11v1; +14v1 -> 4v1; +13v1 -> 14v1; +3v1 -> 13v1; +16v1 -> 4v1; +15v1 -> 16v1; +3v1 -> 15v1; +18v1 -> 4v1; +17v1 -> 18v1; +3v1 -> 17v1; +20v1 -> 4v1; +19v1 -> 20v1; +3v1 -> 19v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@datalog_program.snap new file mode 100644 index 000000000000..17b9d2430293 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@datalog_program.snap @@ -0,0 +1,835 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"union ()\"},\"version\":1},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ ,) | row . 0 == 0)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ ,) | row . 0 != 0)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((2 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ ,) | row . 0 - 1 == 0)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((3 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ ,) | row . 0 - 1 == 1 - 1)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((4 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":1,\"version\":3},{\"idx\":13,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":1,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":22,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"2\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"2\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"3\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"3\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1},{\"idx\":4,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":\"ints\",\"version\":1},{\"value\":\"result_insert\",\"version\":1},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"predicate_1_filter\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"predicate_3_filter\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"predicate_5_filter\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"predicate_7_filter\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_1v3_send, hoff_1v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(1v3)"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_21v1_send, hoff_21v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(21v1)"); + let (hoff_22v1_send, hoff_22v1_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(22v1)"); + let mut sg_2v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_2v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_1v3_send, hoff_6v3_send, hoff_21v1_send, hoff_22v1_send), + false, + move | + context, + var_args!(), + var_args!( + hoff_1v3_send, hoff_6v3_send, hoff_21v1_send, hoff_22v1_send + )| + { + let hoff_1v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_1v3_send.give(Some(v)); + }); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let hoff_21v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_21v1_send.give(Some(v)); + }); + let hoff_22v1_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_22v1_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_25_2_44(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + let op_18v1 = hydroflow::pusherator::filter::Filter::new( + |row: &(_,)| row.0 - 1 == 1 - 1, + hoff_22v1_send, + ); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__filter__loc_nopath_8_12_8_50< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_18v1__filter__loc_nopath_8_12_8_50(op_18v1) + }; + let op_15v1 = hydroflow::pusherator::filter::Filter::new( + |row: &(_,)| row.0 - 1 == 0, + hoff_21v1_send, + ); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__filter__loc_nopath_7_12_7_46< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_15v1__filter__loc_nopath_7_12_7_46(op_15v1) + }; + let op_12v1 = hydroflow::pusherator::filter::Filter::new( + |row: &(_,)| row.0 != 0, + hoff_1v3_send, + ); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__filter__loc_nopath_6_12_6_42< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__filter__loc_nopath_6_12_6_42(op_12v1) + }; + let op_9v1 = hydroflow::pusherator::filter::Filter::new( + |row: &(_,)| row.0 == 0, + hoff_6v3_send, + ); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__filter__loc_nopath_5_12_5_42< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_9v1__filter__loc_nopath_5_12_5_42(op_9v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + op_9v1, + hydroflow::pusherator::tee::Tee::new( + op_12v1, + hydroflow::pusherator::tee::Tee::new(op_15v1, op_18v1), + ), + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_2_19_2_23< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_2_19_2_23(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(hoff_1v3_recv, hoff_6v3_recv, hoff_21v1_recv, hoff_22v1_recv), + var_expr!(), + false, + move | + context, + var_args!( + hoff_1v3_recv, hoff_6v3_recv, hoff_21v1_recv, hoff_22v1_recv + ), + var_args!()| + { + let mut hoff_1v3_recv = hoff_1v3_recv.borrow_mut_swap(); + let hoff_1v3_recv = hoff_1v3_recv.drain(..); + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut hoff_21v1_recv = hoff_21v1_recv.borrow_mut_swap(); + let hoff_21v1_recv = hoff_21v1_recv.drain(..); + let mut hoff_22v1_recv = hoff_22v1_recv.borrow_mut_swap(); + let hoff_22v1_recv = hoff_22v1_recv.drain(..); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = hoff_6v3_recv.map(|row: (_,)| ((1,), ())); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = hoff_1v3_recv.map(|row: (_,)| ((2,), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = hoff_21v1_recv.map(|row: (_,)| ((3,), ())); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_1_0_1_0(op_16v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_17v1 = op_16v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__map__loc_nopath_1_0_1_0(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = hoff_22v1_recv.map(|row: (_,)| ((4,), ())); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_1_0_1_0(op_19v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_20v1 = op_19v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__map__loc_nopath_1_0_1_0(op_20v1) + }; + let op_4v1 = { + #[allow(unused)] + #[inline(always)] + fn check_inputs< + A: ::std::iter::Iterator, + B: ::std::iter::Iterator, + Item, + >(a: A, b: B) -> impl ::std::iter::Iterator { + a.chain(b) + } + check_inputs( + check_inputs(check_inputs(op_11v1, op_14v1), op_17v1), + op_20v1, + ) + }; + let op_4v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_4v1__union__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_4v1__union__loc_nopath_3_20_3_26(op_4v1) + }; + let op_5v1 = op_4v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@surface_graph.snap new file mode 100644 index 000000000000..47d5fbe6d835 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__expr_predicate@surface_graph.snap @@ -0,0 +1,43 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +4v1 = union (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = filter (| row : & (_ ,) | row . 0 == 0); +10v1 = map (| row : (_ ,) | ((1 ,) , ())); +11v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +12v1 = filter (| row : & (_ ,) | row . 0 != 0); +13v1 = map (| row : (_ ,) | ((2 ,) , ())); +14v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +15v1 = filter (| row : & (_ ,) | row . 0 - 1 == 0); +16v1 = map (| row : (_ ,) | ((3 ,) , ())); +17v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +18v1 = filter (| row : & (_ ,) | row . 0 - 1 == 1 - 1); +19v1 = map (| row : (_ ,) | ((4 ,) , ())); +20v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); + +7v1 -> 2v1; +2v1 -> 3v1; +4v1 -> 5v1; +5v1 -> 8v1; +3v1 -> 9v1; +11v1 -> 4v1; +10v1 -> 11v1; +9v1 -> 10v1; +3v1 -> 12v1; +14v1 -> 4v1; +13v1 -> 14v1; +12v1 -> 13v1; +3v1 -> 15v1; +17v1 -> 4v1; +16v1 -> 17v1; +15v1 -> 16v1; +3v1 -> 18v1; +20v1 -> 4v1; +19v1 -> 20v1; +18v1 -> 19v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@datalog_program.snap new file mode 100644 index 000000000000..3e42e0732467 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@datalog_program.snap @@ -0,0 +1,392 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"flat_map (| row : (_ ,) | row . 0 . into_iter () . map (move | __flattened_element | (__flattened_element ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row_untuple : (_ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_9v1 = op_2v1 + .flat_map(|row: (_,)| { + row + .0 + .into_iter() + .map(move |__flattened_element| (__flattened_element,)) + }); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__flat_map__loc_nopath_6_12_6_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__flat_map__loc_nopath_6_12_6_42(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1 + .map(|row_untuple: (_,)| (row_untuple.0.0, row_untuple.0.1)); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_6_12_6_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_6_12_6_42(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_12v1 = op_11v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__map__loc_nopath_1_0_1_0(op_12v1) + }; + let op_5v1 = op_12v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_4_28_4_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@surface_graph.snap new file mode 100644 index 000000000000..3d0b425bc2d2 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flat_then_detuple@surface_graph.snap @@ -0,0 +1,20 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints1); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = flat_map (| row : (_ ,) | row . 0 . into_iter () . map (move | __flattened_element | (__flattened_element ,))); +10v1 = map (| row_untuple : (_ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 ,)); +11v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +12v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +12v1 -> 5v1; +5v1 -> 8v1; +9v1 -> 10v1; +2v1 -> 9v1; +11v1 -> 12v1; +10v1 -> 11v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@datalog_program.snap new file mode 100644 index 000000000000..fa47269838a3 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@datalog_program.snap @@ -0,0 +1,357 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"flat_map (| row : (_ , _ ,) | row . 1 . into_iter () . map (move | __flattened_element | (:: std :: clone :: Clone :: clone (& row . 0) , __flattened_element ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_9v1 = op_2v1 + .flat_map(|row: (_, _)| { + row + .1 + .into_iter() + .map(move |__flattened_element| ( + ::std::clone::Clone::clone(&row.0), + __flattened_element, + )) + }); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__flat_map__loc_nopath_6_12_6_40< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__flat_map__loc_nopath_6_12_6_40(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_4_28_4_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@surface_graph.snap new file mode 100644 index 000000000000..9bf39aabba06 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__flatten@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints1); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = flat_map (| row : (_ , _ ,) | row . 1 . into_iter () . map (move | __flattened_element | (:: std :: clone :: Clone :: clone (& row . 0) , __flattened_element ,))); +10v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +11v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +2v1 -> 9v1; +10v1 -> 11v1; +9v1 -> 10v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@datalog_program.snap new file mode 100644 index 000000000000..05b715ffda5a --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@datalog_program.snap @@ -0,0 +1,2250 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"difference :: < 'tick , 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"difference :: < 'tick , 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result2 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result3 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result4 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"persist :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result5 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"enumerate :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (__enumerate_index , (g , a)) : (_ , ((_ , _ ,) , _)) | (g . 0 , g . 1 , __enumerate_index ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 ,) , ((row . 1) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"enumerate :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (__enumerate_index , (g , a)) : (_ , ((_ ,) , _)) | (g . 0 , a . 0 . unwrap () . 1 , __enumerate_index ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"enumerate :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (__enumerate_index , (g , a)) : (_ , ((_ , _ ,) , _)) | (g . 0 , g . 1 , __enumerate_index ,))\"},\"version\":1},{\"value\":{\"Operator\":\"persist :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 ,) , ((row . 1) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'static , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"enumerate :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (__enumerate_index , (g , a)) : (_ , ((_ ,) , _)) | (g . 0 , a . 0 . unwrap () . 1 , __enumerate_index ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"enumerate :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (__enumerate_index , (g , a)) : (_ , ((_ , _ ,) , _)) | (g . 0 , g . 1 , __enumerate_index ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":26,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":35,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":25,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":39,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":3},{\"idx\":23,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":45,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":3},{\"idx\":20,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":49,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":15,\"version\":3},{\"idx\":18,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":52,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":15,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":12,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":41,\"version\":1},{\"idx\":22,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":23,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":23,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":25,\"version\":1},{\"idx\":9,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":27,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":28,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":29,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":30,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":31,\"version\":1},{\"idx\":32,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":31,\"version\":1}],\"version\":1},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":34,\"version\":1},{\"idx\":35,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":33,\"version\":1},{\"idx\":34,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":33,\"version\":1}],\"version\":1},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":38,\"version\":1},{\"idx\":39,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":37,\"version\":1},{\"idx\":38,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":36,\"version\":1},{\"idx\":21,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":36,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":21,\"version\":3},{\"idx\":37,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":40,\"version\":1},{\"idx\":16,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":40,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":3},{\"idx\":51,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":44,\"version\":1},{\"idx\":45,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":43,\"version\":1},{\"idx\":44,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":42,\"version\":1},{\"idx\":43,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":42,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":3},{\"idx\":47,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":48,\"version\":1},{\"idx\":49,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":47,\"version\":1},{\"idx\":48,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":46,\"version\":1},{\"idx\":13,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":46,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":16,\"version\":3},{\"idx\":41,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":51,\"version\":1},{\"idx\":52,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":50,\"version\":1},{\"idx\":10,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":50,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"2\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"2\"},\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":20,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":25,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":26,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1},{\"idx\":33,\"version\":1},{\"idx\":34,\"version\":1},{\"idx\":35,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":27,\"version\":1},{\"idx\":36,\"version\":1},{\"idx\":40,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":37,\"version\":1},{\"idx\":38,\"version\":1},{\"idx\":39,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":28,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":41,\"version\":1},{\"idx\":22,\"version\":1},{\"idx\":23,\"version\":1},{\"idx\":24,\"version\":1},{\"idx\":42,\"version\":1},{\"idx\":43,\"version\":1},{\"idx\":44,\"version\":1},{\"idx\":45,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":29,\"version\":1},{\"idx\":46,\"version\":1},{\"idx\":50,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":47,\"version\":1},{\"idx\":48,\"version\":1},{\"idx\":49,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":30,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":51,\"version\":1},{\"idx\":52,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":31,\"version\":1},{\"idx\":32,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":2,\"version\":1},{\"value\":1,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":\"ints\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result3_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result4_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result5_insert\",\"version\":1},{\"value\":\"result5\",\"version\":1},{\"value\":\"result5\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_persisted_insert\",\"version\":1},{\"value\":\"ints_persisted\",\"version\":1},{\"value\":\"ints_persisted\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_9v3_send, hoff_9v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(9v3)"); + let (hoff_10v3_send, hoff_10v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(10v3)"); + let (hoff_12v3_send, hoff_12v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(12v3)"); + let (hoff_13v3_send, hoff_13v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(13v3)"); + let (hoff_15v3_send, hoff_15v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(15v3)"); + let (hoff_16v3_send, hoff_16v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(16v3)"); + let (hoff_21v3_send, hoff_21v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(21v3)"); + let mut sg_3v1_node_26v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_3v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_34v1_counterdata = df + .add_state(::std::cell::RefCell::new(0..)); + df.set_state_tick_hook( + sg_3v1_node_34v1_counterdata, + |rcell| { + rcell.replace(0..); + }, + ); + let sg_4v1_node_37v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + let sg_4v1_node_38v1_counterdata = df + .add_state(::std::cell::RefCell::new(0..)); + df.set_state_tick_hook( + sg_4v1_node_38v1_counterdata, + |rcell| { + rcell.replace(0..); + }, + ); + let sg_4v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_5v1_node_22v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_5v1_node_23v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new(hydroflow::rustc_hash::FxHashSet::default()), + ); + let sg_5v1_node_23v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_5v1_node_11v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let singleton_op_45v1 = df + .add_state(::std::cell::RefCell::new(::std::vec::Vec::new())); + let sg_5v1_node_43v1_counterdata = df + .add_state(::std::cell::RefCell::new(0..)); + let sg_6v1_node_47v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + let sg_6v1_node_48v1_counterdata = df + .add_state(::std::cell::RefCell::new(0..)); + df.set_state_tick_hook( + sg_6v1_node_48v1_counterdata, + |rcell| { + rcell.replace(0..); + }, + ); + let sg_6v1_node_14v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_7v1_node_51v1_counterdata = df + .add_state(::std::cell::RefCell::new(0..)); + let sg_7v1_node_17v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_7v1_node_18v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new(hydroflow::rustc_hash::FxHashSet::default()), + ); + let sg_7v1_node_18v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let singleton_op_31v1 = df + .add_state(::std::cell::RefCell::new(::std::vec::Vec::new())); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(3v1)", + 0, + var_expr!(), + var_expr!(hoff_16v3_send, hoff_21v3_send), + false, + move |context, var_args!(), var_args!(hoff_16v3_send, hoff_21v3_send)| { + let hoff_16v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_16v3_send.give(Some(v)); + }); + let hoff_21v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_21v3_send.give(Some(v)); + }); + let op_26v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_3v1_node_26v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_26v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_26v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_26v1__source_stream__loc_nopath_2_25_2_44(op_26v1) + }; + let op_2v1 = op_26v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_3v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + let op_40v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.0, row.1), ()), + hoff_16v3_send, + ); + let op_40v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_40v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_40v1__map__loc_nopath_1_0_1_0(op_40v1) + }; + let op_36v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.0,), ((row.1),)), + hoff_21v3_send, + ); + let op_36v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_36v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_36v1__map__loc_nopath_1_0_1_0(op_36v1) + }; + let op_27v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_27v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_27v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_27v1__for_each__loc_nopath_4_28_4_65(op_27v1) + }; + let op_5v1 = hydroflow::pusherator::filter::Filter::new( + |item| { + let mut borrow = context + .state_ref(sg_3v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }, + op_27v1, + ); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_35v1 = hydroflow::pusherator::map::Map::new( + |(__enumerate_index, (g, a)): (_, ((_, _), _))| ( + g.0, + g.1, + __enumerate_index, + ), + op_5v1, + ); + let op_35v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_35v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_35v1__map__loc_nopath_1_0_1_0(op_35v1) + }; + let op_34v1 = hydroflow::pusherator::map::Map::new( + |item| { + let mut counter = context + .state_ref(sg_3v1_node_34v1_counterdata) + .borrow_mut(); + (counter.next().unwrap(), item) + }, + op_35v1, + ); + let op_34v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_34v1__enumerate__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_34v1__enumerate__loc_nopath_1_0_1_0(op_34v1) + }; + let op_33v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.0, row.1), ()), + op_34v1, + ); + let op_33v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_33v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_33v1__map__loc_nopath_1_0_1_0(op_33v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + op_33v1, + hydroflow::pusherator::tee::Tee::new(op_36v1, op_40v1), + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_2_19_2_23< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_2_19_2_23(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_3v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_3v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(hoff_12v3_recv), + var_expr!(hoff_15v3_send), + false, + move |context, var_args!(hoff_12v3_recv), var_args!(hoff_15v3_send)| { + let mut hoff_12v3_recv = hoff_12v3_recv.borrow_mut_swap(); + let hoff_12v3_recv = hoff_12v3_recv.drain(..); + let hoff_15v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_15v3_send.give(Some(v)); + }); + let op_20v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_12v3_recv) + }; + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__defer_tick__loc_nopath_9_21_9_28< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__defer_tick__loc_nopath_9_21_9_28(op_20v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_20v1, hoff_15v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(hoff_6v3_recv), + var_expr!(hoff_9v3_send), + false, + move |context, var_args!(hoff_6v3_recv), var_args!(hoff_9v3_send)| { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let hoff_9v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_9v3_send.give(Some(v)); + }); + let op_25v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_6v3_recv) + }; + let op_25v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_25v1__defer_tick__loc_nopath_15_21_15_35< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_25v1__defer_tick__loc_nopath_15_21_15_35(op_25v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_25v1, hoff_9v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(4v1)", + 1, + var_expr!(hoff_21v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_21v3_recv), var_args!()| { + let mut hoff_21v3_recv = hoff_21v3_recv.borrow_mut_swap(); + let hoff_21v3_recv = hoff_21v3_recv.drain(..); + let mut sg_4v1_node_37v1_hashtable = context + .state_ref(sg_4v1_node_37v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_21v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_4v1_node_37v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some({ + let prev: (hydroflow::rustc_hash::FxHashSet<_>, _) = prev; + let mut set: hydroflow::rustc_hash::FxHashSet<_> = prev.0; + if set.insert(val.0) { + (set, prev.1 + 1) + } else { + (set, prev.1) + } + }) + } else { + Some({ + let mut set = hydroflow::rustc_hash::FxHashSet::< + _, + >::default(); + set.insert(val.0); + (set, 1) + }) + }; + }, + ); + } + } + let op_37v1 = sg_4v1_node_37v1_hashtable.drain(); + let op_37v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_37v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_37v1__fold_keyed__loc_nopath_1_0_1_0(op_37v1) + }; + let op_38v1 = ::std::iter::Iterator::map( + op_37v1, + |item| { + let mut counter = context + .state_ref(sg_4v1_node_38v1_counterdata) + .borrow_mut(); + (counter.next().unwrap(), item) + }, + ); + let op_38v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_38v1__enumerate__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_38v1__enumerate__loc_nopath_1_0_1_0(op_38v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_39v1 = op_38v1 + .map(|(__enumerate_index, (g, a)): (_, ((_,), _))| ( + g.0, + a.0.unwrap().1, + __enumerate_index, + )); + let op_39v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_39v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_39v1__map__loc_nopath_1_0_1_0(op_39v1) + }; + let op_8v1 = op_39v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_4v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_5_20_5_27< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_5_20_5_27(op_8v1) + }; + let op_28v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result2.send(v).unwrap() + }); + let op_28v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_28v1__for_each__loc_nopath_5_29_5_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_28v1__for_each__loc_nopath_5_29_5_67(op_28v1) + }; + #[inline(always)] + fn pivot_run_sg_4v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_4v1(op_8v1, op_28v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(5v1)", + 1, + var_expr!(hoff_9v3_recv, hoff_16v3_recv), + var_expr!(hoff_6v3_send, hoff_10v3_send, hoff_13v3_send), + false, + move | + context, + var_args!(hoff_9v3_recv, hoff_16v3_recv), + var_args!(hoff_6v3_send, hoff_10v3_send, hoff_13v3_send)| + { + let mut hoff_9v3_recv = hoff_9v3_recv.borrow_mut_swap(); + let hoff_9v3_recv = hoff_9v3_recv.drain(..); + let mut hoff_16v3_recv = hoff_16v3_recv.borrow_mut_swap(); + let hoff_16v3_recv = hoff_16v3_recv.drain(..); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let hoff_10v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_10v3_send.give(Some(v)); + }); + let hoff_13v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_13v3_send.give(Some(v)); + }); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_41v1 = hoff_16v3_recv.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_41v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_41v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_41v1__map__loc_nopath_1_0_1_0(op_41v1) + }; + let op_22v1 = op_41v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_5v1_node_22v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_22v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_22v1__unique__loc_nopath_15_21_15_35< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_22v1__unique__loc_nopath_15_21_15_35(op_22v1) + }; + let op_22v1 = op_22v1.map(|k| (k, ())); + let mut sg_5v1_node_23v1_antijoindata_neg_borrow = context + .state_ref(sg_5v1_node_23v1_antijoindata_neg) + .borrow_mut(); + let mut sg_5v1_node_23v1_antijoindata_pos_borrow = context + .state_ref(sg_5v1_node_23v1_antijoindata_pos) + .borrow_mut(); + let op_23v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_9v3_recv, + op_22v1, + &mut *sg_5v1_node_23v1_antijoindata_neg_borrow, + &mut *sg_5v1_node_23v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_23v1 = op_23v1.map(|(k, ())| k); + let op_23v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_23v1__difference__loc_nopath_15_21_15_35< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_23v1__difference__loc_nopath_15_21_15_35(op_23v1) + }; + let op_50v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.0, row.1), ()), + hoff_10v3_send, + ); + let op_50v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_50v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_50v1__map__loc_nopath_1_0_1_0(op_50v1) + }; + let op_46v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.0,), ((row.1),)), + hoff_13v3_send, + ); + let op_46v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_46v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_46v1__map__loc_nopath_1_0_1_0(op_46v1) + }; + let op_29v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result3.send(v).unwrap() + }); + let op_29v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_29v1__for_each__loc_nopath_6_29_6_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_29v1__for_each__loc_nopath_6_29_6_67(op_29v1) + }; + let op_11v1 = hydroflow::pusherator::filter::Filter::new( + |item| { + let mut borrow = context + .state_ref(sg_5v1_node_11v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }, + op_29v1, + ); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__unique__loc_nopath_6_20_6_27< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_11v1__unique__loc_nopath_6_20_6_27(op_11v1) + }; + let mut sg_5v1_node_45v1_persistvec = context + .state_ref(singleton_op_45v1) + .borrow_mut(); + let op_45v1 = { + fn constrain_types<'ctx, Push, Item>( + vec: &'ctx mut Vec, + mut output: Push, + is_new_tick: bool, + ) -> impl 'ctx + hydroflow::pusherator::Pusherator + where + Push: 'ctx + hydroflow::pusherator::Pusherator, + Item: ::std::clone::Clone, + { + if is_new_tick { + vec.iter() + .cloned() + .for_each(|item| { + hydroflow::pusherator::Pusherator::give(&mut output, item); + }); + } + hydroflow::pusherator::map::Map::new( + |item| { + vec.push(item); + vec.last().unwrap().clone() + }, + output, + ) + } + constrain_types( + &mut *sg_5v1_node_45v1_persistvec, + op_11v1, + context.is_first_run_this_tick(), + ) + }; + let op_45v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_45v1__persist__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_45v1__persist__loc_nopath_1_0_1_0(op_45v1) + }; + let op_44v1 = hydroflow::pusherator::map::Map::new( + |(__enumerate_index, (g, a)): (_, ((_, _), _))| ( + g.0, + g.1, + __enumerate_index, + ), + op_45v1, + ); + let op_44v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_44v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_44v1__map__loc_nopath_1_0_1_0(op_44v1) + }; + let op_43v1 = hydroflow::pusherator::map::Map::new( + |item| { + let mut counter = context + .state_ref(sg_5v1_node_43v1_counterdata) + .borrow_mut(); + (counter.next().unwrap(), item) + }, + op_44v1, + ); + let op_43v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_43v1__enumerate__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_43v1__enumerate__loc_nopath_1_0_1_0(op_43v1) + }; + let op_42v1 = hydroflow::pusherator::map::Map::new( + |row: (_, _)| ((row.0, row.1), ()), + op_43v1, + ); + let op_42v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_42v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_42v1__map__loc_nopath_1_0_1_0(op_42v1) + }; + let op_24v1 = hydroflow::pusherator::tee::Tee::new( + op_42v1, + hydroflow::pusherator::tee::Tee::new( + op_46v1, + hydroflow::pusherator::tee::Tee::new(op_50v1, hoff_6v3_send), + ), + ); + let op_24v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_24v1__tee__loc_nopath_15_21_15_35< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_24v1__tee__loc_nopath_15_21_15_35(op_24v1) + }; + #[inline(always)] + fn pivot_run_sg_5v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_5v1(op_23v1, op_24v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(6v1)", + 2, + var_expr!(hoff_13v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_13v3_recv), var_args!()| { + let mut hoff_13v3_recv = hoff_13v3_recv.borrow_mut_swap(); + let hoff_13v3_recv = hoff_13v3_recv.drain(..); + let mut sg_6v1_node_47v1_hashtable = context + .state_ref(sg_6v1_node_47v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_13v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_6v1_node_47v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some({ + let prev: (hydroflow::rustc_hash::FxHashSet<_>, _) = prev; + let mut set: hydroflow::rustc_hash::FxHashSet<_> = prev.0; + if set.insert(val.0) { + (set, prev.1 + 1) + } else { + (set, prev.1) + } + }) + } else { + Some({ + let mut set = hydroflow::rustc_hash::FxHashSet::< + _, + >::default(); + set.insert(val.0); + (set, 1) + }) + }; + }, + ); + } + } + let op_47v1 = context + .is_first_run_this_tick() + .then_some(sg_6v1_node_47v1_hashtable.iter()) + .into_iter() + .flatten() + .map( + #[allow( + unknown_lints, + suspicious_double_ref_op, + clippy::clone_on_copy + )] + |(k, v)| ( + ::std::clone::Clone::clone(k), + ::std::clone::Clone::clone(v), + ), + ); + let op_47v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_47v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_47v1__fold_keyed__loc_nopath_1_0_1_0(op_47v1) + }; + let op_48v1 = ::std::iter::Iterator::map( + op_47v1, + |item| { + let mut counter = context + .state_ref(sg_6v1_node_48v1_counterdata) + .borrow_mut(); + (counter.next().unwrap(), item) + }, + ); + let op_48v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_48v1__enumerate__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_48v1__enumerate__loc_nopath_1_0_1_0(op_48v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_49v1 = op_48v1 + .map(|(__enumerate_index, (g, a)): (_, ((_,), _))| ( + g.0, + a.0.unwrap().1, + __enumerate_index, + )); + let op_49v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_49v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_49v1__map__loc_nopath_1_0_1_0(op_49v1) + }; + let op_14v1 = op_49v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_6v1_node_14v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__unique__loc_nopath_7_20_7_27< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__unique__loc_nopath_7_20_7_27(op_14v1) + }; + let op_30v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result4.send(v).unwrap() + }); + let op_30v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_30v1__for_each__loc_nopath_7_29_7_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_30v1__for_each__loc_nopath_7_29_7_67(op_30v1) + }; + #[inline(always)] + fn pivot_run_sg_6v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_6v1(op_14v1, op_30v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(7v1)", + 1, + var_expr!(hoff_10v3_recv, hoff_15v3_recv), + var_expr!(hoff_12v3_send), + false, + move | + context, + var_args!(hoff_10v3_recv, hoff_15v3_recv), + var_args!(hoff_12v3_send)| + { + let mut hoff_10v3_recv = hoff_10v3_recv.borrow_mut_swap(); + let hoff_10v3_recv = hoff_10v3_recv.drain(..); + let mut hoff_15v3_recv = hoff_15v3_recv.borrow_mut_swap(); + let hoff_15v3_recv = hoff_15v3_recv.drain(..); + let hoff_12v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_12v3_send.give(Some(v)); + }); + let op_51v1 = ::std::iter::Iterator::map( + hoff_10v3_recv, + |item| { + let mut counter = context + .state_ref(sg_7v1_node_51v1_counterdata) + .borrow_mut(); + (counter.next().unwrap(), item) + }, + ); + let op_51v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_51v1__enumerate__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_51v1__enumerate__loc_nopath_1_0_1_0(op_51v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_52v1 = op_51v1 + .map(|(__enumerate_index, (g, a)): (_, ((_, _), _))| ( + g.0, + g.1, + __enumerate_index, + )); + let op_52v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_52v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_52v1__map__loc_nopath_1_0_1_0(op_52v1) + }; + let op_17v1 = op_52v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_7v1_node_17v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__unique__loc_nopath_9_21_9_28< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__unique__loc_nopath_9_21_9_28(op_17v1) + }; + let op_17v1 = op_17v1.map(|k| (k, ())); + let mut sg_7v1_node_18v1_antijoindata_neg_borrow = context + .state_ref(sg_7v1_node_18v1_antijoindata_neg) + .borrow_mut(); + let mut sg_7v1_node_18v1_antijoindata_pos_borrow = context + .state_ref(sg_7v1_node_18v1_antijoindata_pos) + .borrow_mut(); + let op_18v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_15v3_recv, + op_17v1, + &mut *sg_7v1_node_18v1_antijoindata_neg_borrow, + &mut *sg_7v1_node_18v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_18v1 = op_18v1.map(|(k, ())| k); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__difference__loc_nopath_9_21_9_28< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__difference__loc_nopath_9_21_9_28(op_18v1) + }; + let op_32v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result5.send(v).unwrap() + }); + let op_32v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_32v1__for_each__loc_nopath_10_29_10_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_32v1__for_each__loc_nopath_10_29_10_67(op_32v1) + }; + let mut sg_7v1_node_31v1_persistvec = context + .state_ref(singleton_op_31v1) + .borrow_mut(); + let op_31v1 = { + fn constrain_types<'ctx, Push, Item>( + vec: &'ctx mut Vec, + mut output: Push, + is_new_tick: bool, + ) -> impl 'ctx + hydroflow::pusherator::Pusherator + where + Push: 'ctx + hydroflow::pusherator::Pusherator, + Item: ::std::clone::Clone, + { + if is_new_tick { + vec.iter() + .cloned() + .for_each(|item| { + hydroflow::pusherator::Pusherator::give(&mut output, item); + }); + } + hydroflow::pusherator::map::Map::new( + |item| { + vec.push(item); + vec.last().unwrap().clone() + }, + output, + ) + } + constrain_types( + &mut *sg_7v1_node_31v1_persistvec, + op_32v1, + context.is_first_run_this_tick(), + ) + }; + let op_31v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_31v1__persist__loc_nopath_10_20_10_27< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_31v1__persist__loc_nopath_10_20_10_27(op_31v1) + }; + let op_19v1 = hydroflow::pusherator::tee::Tee::new( + op_31v1, + hoff_12v3_send, + ); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__tee__loc_nopath_9_21_9_28< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_19v1__tee__loc_nopath_9_21_9_28(op_19v1) + }; + #[inline(always)] + fn pivot_run_sg_7v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_7v1(op_18v1, op_19v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@surface_graph.snap new file mode 100644 index 000000000000..82686feaa2e0 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__index@surface_graph.snap @@ -0,0 +1,88 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +11v1 = unique :: < 'tick > (); +14v1 = unique :: < 'tick > (); +17v1 = unique :: < 'tick > (); +18v1 = difference :: < 'tick , 'static > (); +19v1 = tee (); +20v1 = defer_tick (); +22v1 = unique :: < 'tick > (); +23v1 = difference :: < 'tick , 'static > (); +24v1 = tee (); +25v1 = defer_tick (); +26v1 = source_stream (ints); +27v1 = for_each (| v | result . send (v) . unwrap ()); +28v1 = for_each (| v | result2 . send (v) . unwrap ()); +29v1 = for_each (| v | result3 . send (v) . unwrap ()); +30v1 = for_each (| v | result4 . send (v) . unwrap ()); +31v1 = persist :: < 'static > (); +32v1 = for_each (| v | result5 . send (v) . unwrap ()); +33v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +34v1 = enumerate :: < 'tick > (); +35v1 = map (| (__enumerate_index , (g , a)) : (_ , ((_ , _ ,) , _)) | (g . 0 , g . 1 , __enumerate_index ,)); +36v1 = map (| row : (_ , _ ,) | ((row . 0 ,) , ((row . 1) ,))); +37v1 = fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; }); +38v1 = enumerate :: < 'tick > (); +39v1 = map (| (__enumerate_index , (g , a)) : (_ , ((_ ,) , _)) | (g . 0 , a . 0 . unwrap () . 1 , __enumerate_index ,)); +40v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +41v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); +42v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +43v1 = enumerate :: < 'static > (); +44v1 = map (| (__enumerate_index , (g , a)) : (_ , ((_ , _ ,) , _)) | (g . 0 , g . 1 , __enumerate_index ,)); +45v1 = persist :: < 'static > (); +46v1 = map (| row : (_ , _ ,) | ((row . 0 ,) , ((row . 1) ,))); +47v1 = fold_keyed :: < 'static , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; }); +48v1 = enumerate :: < 'tick > (); +49v1 = map (| (__enumerate_index , (g , a)) : (_ , ((_ ,) , _)) | (g . 0 , a . 0 . unwrap () . 1 , __enumerate_index ,)); +50v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +51v1 = enumerate :: < 'static > (); +52v1 = map (| (__enumerate_index , (g , a)) : (_ , ((_ , _ ,) , _)) | (g . 0 , g . 1 , __enumerate_index ,)); + +26v1 -> 2v1; +2v1 -> 3v1; +35v1 -> 5v1; +39v1 -> 8v1; +45v1 -> 11v1; +49v1 -> 14v1; +52v1 -> 17v1; +18v1 -> 19v1; +17v1 -> 18v1; +20v1 -> 18v1; +19v1 -> 20v1; +41v1 -> 22v1; +23v1 -> 24v1; +22v1 -> 23v1; +25v1 -> 23v1; +24v1 -> 25v1; +5v1 -> 27v1; +8v1 -> 28v1; +11v1 -> 29v1; +14v1 -> 30v1; +31v1 -> 32v1; +19v1 -> 31v1; +34v1 -> 35v1; +33v1 -> 34v1; +3v1 -> 33v1; +38v1 -> 39v1; +37v1 -> 38v1; +36v1 -> 37v1; +3v1 -> 36v1; +40v1 -> 41v1; +3v1 -> 40v1; +44v1 -> 45v1; +43v1 -> 44v1; +42v1 -> 43v1; +24v1 -> 42v1; +48v1 -> 49v1; +47v1 -> 48v1; +46v1 -> 47v1; +24v1 -> 46v1; +51v1 -> 52v1; +50v1 -> 51v1; +24v1 -> 50v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@datalog_program.snap new file mode 100644 index 000000000000..86e1a6a7115c --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@datalog_program.snap @@ -0,0 +1,638 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (in1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (in2)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ , _ ,) , (() , ())) | (kv . 0 . 0 , kv . 0 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 , _v . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 1 , _v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_10v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_1v1_node_11v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in2) + }; + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_13v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_13v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_13v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_13v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_10v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_10v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__source_stream__loc_nopath_2_24_2_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__source_stream__loc_nopath_2_24_2_42(op_10v1) + }; + let op_2v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_22(op_2v1) + }; + let op_11v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_11v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__source_stream__loc_nopath_3_24_3_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__source_stream__loc_nopath_3_24_3_42(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_22(op_5v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_2v1.map(|_v: (_, _)| ((_v.0, _v.1), ())); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_6_25_6_34< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_6_25_6_34(op_15v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = op_5v1.map(|_v: (_, _)| ((_v.1, _v.0), ())); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_6_36_6_45< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_6_36_6_45(op_16v1) + }; + let mut sg_1v1_node_13v1_joindata_lhs_borrow = context + .state_ref(sg_1v1_node_13v1_joindata_lhs) + .borrow_mut(); + let mut sg_1v1_node_13v1_joindata_rhs_borrow = context + .state_ref(sg_1v1_node_13v1_joindata_rhs) + .borrow_mut(); + let op_13v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_15v1, + op_16v1, + &mut *sg_1v1_node_13v1_joindata_lhs_borrow, + &mut *sg_1v1_node_13v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__join__loc_nopath_6_12_6_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__join__loc_nopath_6_12_6_46(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|kv: ((_, _), ((), ()))| (kv.0.0, kv.0.1)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_6_12_6_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_6_12_6_46(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_17v1 = op_14v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__map__loc_nopath_1_0_1_0(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_1_0_1_0(op_18v1) + }; + let op_8v1 = op_18v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_4_20_4_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_4_20_4_23(op_8v1) + }; + let op_12v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__for_each__loc_nopath_4_25_4_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__for_each__loc_nopath_4_25_4_59(op_12v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_8v1, op_12v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@surface_graph.snap new file mode 100644 index 000000000000..ef42837efe80 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_other@surface_graph.snap @@ -0,0 +1,28 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +10v1 = source_stream (in1); +11v1 = source_stream (in2); +12v1 = for_each (| v | out . send (v) . unwrap ()); +13v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +14v1 = map (| kv : ((_ , _ ,) , (() , ())) | (kv . 0 . 0 , kv . 0 . 1 ,)); +15v1 = map (| _v : (_ , _ ,) | ((_v . 0 , _v . 1 ,) , ())); +16v1 = map (| _v : (_ , _ ,) | ((_v . 1 , _v . 0 ,) , ())); +17v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +18v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +10v1 -> 2v1; +11v1 -> 5v1; +18v1 -> 8v1; +8v1 -> 12v1; +13v1 -> 14v1; +15v1 -> 13v1; +2v1 -> 15v1; +16v1 -> 13v1; +5v1 -> 16v1; +17v1 -> 18v1; +14v1 -> 17v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@datalog_program.snap new file mode 100644 index 000000000000..efa6b2266700 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@datalog_program.snap @@ -0,0 +1,600 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (input)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ , _ ,) , (() , ())) | (kv . 0 . 0 , kv . 0 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 , _v . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 1 , _v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":4,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":3},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"input_insert\",\"version\":1},{\"value\":\"input\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_4v3_send, hoff_4v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(4v3)"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(input) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_2v1_node_9v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_2v1_node_9v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_2v1_node_9v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_2v1_node_9v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_2v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(hoff_4v3_send, hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_4v3_send, hoff_6v3_send)| { + let hoff_4v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_4v3_send.give(Some(v)); + }); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + hoff_6v3_send, + hoff_4v3_send, + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_2_19_2_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_2_19_2_24(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(hoff_4v3_recv, hoff_6v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_4v3_recv, hoff_6v3_recv), var_args!()| { + let mut hoff_4v3_recv = hoff_4v3_recv.borrow_mut_swap(); + let hoff_4v3_recv = hoff_4v3_recv.drain(..); + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = hoff_6v3_recv.map(|_v: (_, _)| ((_v.0, _v.1), ())); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_5_25_5_36< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_5_25_5_36(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_12v1 = hoff_4v3_recv.map(|_v: (_, _)| ((_v.1, _v.0), ())); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__map__loc_nopath_5_38_5_49< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__map__loc_nopath_5_38_5_49(op_12v1) + }; + let mut sg_2v1_node_9v1_joindata_lhs_borrow = context + .state_ref(sg_2v1_node_9v1_joindata_lhs) + .borrow_mut(); + let mut sg_2v1_node_9v1_joindata_rhs_borrow = context + .state_ref(sg_2v1_node_9v1_joindata_rhs) + .borrow_mut(); + let op_9v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_11v1, + op_12v1, + &mut *sg_2v1_node_9v1_joindata_lhs_borrow, + &mut *sg_2v1_node_9v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__join__loc_nopath_5_12_5_50< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__join__loc_nopath_5_12_5_50(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|kv: ((_, _), ((), ()))| (kv.0.0, kv.0.1)); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_5_12_5_50< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_5_12_5_50(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = op_10v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + let op_5v1 = op_14v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_23(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_25_3_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_25_3_59(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@surface_graph.snap new file mode 100644 index 000000000000..bb6d321646ae --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__join_with_self@surface_graph.snap @@ -0,0 +1,27 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (input); +8v1 = for_each (| v | out . send (v) . unwrap ()); +9v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +10v1 = map (| kv : ((_ , _ ,) , (() , ())) | (kv . 0 . 0 , kv . 0 . 1 ,)); +11v1 = map (| _v : (_ , _ ,) | ((_v . 0 , _v . 1 ,) , ())); +12v1 = map (| _v : (_ , _ ,) | ((_v . 1 , _v . 0 ,) , ())); +13v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +14v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +2v1 -> 3v1; +14v1 -> 5v1; +5v1 -> 8v1; +9v1 -> 10v1; +11v1 -> 9v1; +3v1 -> 11v1; +12v1 -> 9v1; +3v1 -> 12v1; +13v1 -> 14v1; +10v1 -> 13v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program-2.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program-2.snap new file mode 100644 index 000000000000..ac7db8aadfbd --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program-2.snap @@ -0,0 +1,354 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (input)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ , _ , _ , _ ,) | row . 0 == row . 1 && row . 2 == row . 3)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ , _ , _ ,) | ((row . 0 . clone () , row . 0 , row . 2 . clone () , row . 2 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 , g . 3 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"input_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(input) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_9v1 = op_2v1 + .filter(|row: &(_, _, _, _)| row.0 == row.1 && row.2 == row.3); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__filter__loc_nopath_5_12_5_49< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__filter__loc_nopath_5_12_5_49(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1 + .map(|row: (_, _, _, _)| ( + (row.0.clone(), row.0, row.2.clone(), row.2), + (), + )); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1 + .map(|(g, a): ((_, _, _, _), _)| (g.0, g.1, g.2, g.3)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_23(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_25_3_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_25_3_59(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program.snap new file mode 100644 index 000000000000..4e5dc40e34eb --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@datalog_program.snap @@ -0,0 +1,348 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (input)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ , _ ,) | row . 0 == row . 1)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 . clone () , row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"input_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(input) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_9v1 = op_2v1.filter(|row: &(_, _)| row.0 == row.1); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__filter__loc_nopath_5_12_5_37< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__filter__loc_nopath_5_12_5_37(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|row: (_, _)| ((row.0.clone(), row.0), ())); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_23(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_25_3_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_25_3_59(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph-2.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph-2.snap new file mode 100644 index 000000000000..ed12c1665cc9 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph-2.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (input); +8v1 = for_each (| v | out . send (v) . unwrap ()); +9v1 = filter (| row : & (_ , _ , _ , _ ,) | row . 0 == row . 1 && row . 2 == row . 3); +10v1 = map (| row : (_ , _ , _ , _ ,) | ((row . 0 . clone () , row . 0 , row . 2 . clone () , row . 2 ,) , ())); +11v1 = map (| (g , a) : ((_ , _ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 , g . 3 ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +2v1 -> 9v1; +10v1 -> 11v1; +9v1 -> 10v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph.snap new file mode 100644 index 000000000000..df5a63d279f9 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__local_constraints@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (input); +8v1 = for_each (| v | out . send (v) . unwrap ()); +9v1 = filter (| row : & (_ , _ ,) | row . 0 == row . 1); +10v1 = map (| row : (_ , _ ,) | ((row . 0 . clone () , row . 0 ,) , ())); +11v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +2v1 -> 9v1; +10v1 -> 11v1; +9v1 -> 10v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@datalog_program.snap new file mode 100644 index 000000000000..49ead8d6c1f4 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@datalog_program.snap @@ -0,0 +1,429 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 ,) , (row . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (std :: cmp :: max (prev , val . 0)) } else { Some (val . 0) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () , g . 0 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let mut sg_2v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_2v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_10v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(_,), (Option<_>,)>::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_6v3_send)| { + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_25_2_44(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1.map(|row: (_, _)| ((row.1,), (row.0,))); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_1_0_1_0(op_9v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_9v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 1, + var_expr!(hoff_6v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_6v3_recv), var_args!()| { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut sg_1v1_node_10v1_hashtable = context + .state_ref(sg_1v1_node_10v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_6v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_1v1_node_10v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some(std::cmp::max(prev, val.0)) + } else { + Some(val.0) + }; + }, + ); + } + } + let op_10v1 = sg_1v1_node_10v1_hashtable.drain(); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__fold_keyed__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_,), _)| (a.0.unwrap(), g.0)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@surface_graph.snap new file mode 100644 index 000000000000..64008763afde --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row : (_ , _ ,) | ((row . 1 ,) , (row . 0 ,))); +10v1 = fold_keyed :: < 'tick , (_ ,) , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (std :: cmp :: max (prev , val . 0)) } else { Some (val . 0) } ; }); +11v1 = map (| (g , a) : ((_ ,) , _) | (a . 0 . unwrap () , g . 0 ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +10v1 -> 11v1; +9v1 -> 10v1; +2v1 -> 9v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@datalog_program.snap new file mode 100644 index 000000000000..2c020254b129 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@datalog_program.snap @@ -0,0 +1,438 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | (() , (row . 0 , row . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , () , (Option < _ > , Option < _ > ,) > (| | (None , None ,) , | old : & mut (Option < _ > , Option < _ > ,) , val : (_ , _ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (std :: cmp :: max (prev , val . 0)) } else { Some (val . 0) } ; old . 1 = if let Some (prev) = old . 1 . take () { Some (std :: cmp :: max (prev , val . 1)) } else { Some (val . 1) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : (() , _) | (a . 0 . unwrap () , a . 1 . unwrap () ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let mut sg_2v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_2v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_10v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::< + (), + (Option<_>, Option<_>), + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_6v3_send)| { + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_25_2_44(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1.map(|row: (_, _)| ((), (row.0, row.1))); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_1_0_1_0(op_9v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_9v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 1, + var_expr!(hoff_6v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_6v3_recv), var_args!()| { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut sg_1v1_node_10v1_hashtable = context + .state_ref(sg_1v1_node_10v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_6v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_1v1_node_10v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None, None)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>, Option<_>), val: (_, _)| { + old.0 = if let Some(prev) = old.0.take() { + Some(std::cmp::max(prev, val.0)) + } else { + Some(val.0) + }; + old.1 = if let Some(prev) = old.1.take() { + Some(std::cmp::max(prev, val.1)) + } else { + Some(val.1) + }; + }, + ); + } + } + let op_10v1 = sg_1v1_node_10v1_hashtable.drain(); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__fold_keyed__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1 + .map(|(g, a): ((), _)| (a.0.unwrap(), a.1.unwrap())); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@surface_graph.snap new file mode 100644 index 000000000000..62617b30d3d5 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__max_all@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row : (_ , _ ,) | (() , (row . 0 , row . 1 ,))); +10v1 = fold_keyed :: < 'tick , () , (Option < _ > , Option < _ > ,) > (| | (None , None ,) , | old : & mut (Option < _ > , Option < _ > ,) , val : (_ , _ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (std :: cmp :: max (prev , val . 0)) } else { Some (val . 0) } ; old . 1 = if let Some (prev) = old . 1 . take () { Some (std :: cmp :: max (prev , val . 1)) } else { Some (val . 1) } ; }); +11v1 = map (| (g , a) : (() , _) | (a . 0 . unwrap () , a . 1 . unwrap () ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +10v1 -> 11v1; +9v1 -> 10v1; +2v1 -> 9v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@datalog_program.snap new file mode 100644 index 000000000000..8d4262c4eee9 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@datalog_program.snap @@ -0,0 +1,315 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (input)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 , row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"input_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(input) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1.map(|row: (_, _)| ((row.1, row.0), ())); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_1_0_1_0(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + let op_5v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_23(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_25_3_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_25_3_59(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@surface_graph.snap new file mode 100644 index 000000000000..c9b222ec3488 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__minimal_program@surface_graph.snap @@ -0,0 +1,16 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (input); +8v1 = for_each (| v | out . send (v) . unwrap ()); +9v1 = map (| row : (_ , _ ,) | ((row . 1 , row . 0 ,) , ())); +10v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +10v1 -> 5v1; +5v1 -> 8v1; +9v1 -> 10v1; +2v1 -> 9v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@datalog_program.snap new file mode 100644 index 000000000000..792f60606fd0 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@datalog_program.snap @@ -0,0 +1,402 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row_untuple : (_ , _ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 , row_untuple . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row_untuple : (_ , _ , _ ,) | (row_untuple . 0 , row_untuple . 1 , row_untuple . 2 . 0 , row_untuple . 2 . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ , _ , _ ,) | ((row . 0 , row . 1 , row . 2 , row . 3 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 , g . 3 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"source_reader_0\",\"version\":1},{\"value\":\"source_reader_0\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1 + .map(|row_untuple: (_, _)| ( + row_untuple.0.0, + row_untuple.0.1, + row_untuple.1, + )); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_6_12_6_55< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_6_12_6_55(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1 + .map(|row_untuple: (_, _, _)| ( + row_untuple.0, + row_untuple.1, + row_untuple.2.0, + row_untuple.2.1, + )); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_6_12_6_55< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_6_12_6_55(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1 + .map(|row: (_, _, _, _)| ((row.0, row.1, row.2, row.3), ())); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_12v1 = op_11v1 + .map(|(g, a): ((_, _, _, _), _)| (g.0, g.1, g.2, g.3)); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__map__loc_nopath_1_0_1_0(op_12v1) + }; + let op_5v1 = op_12v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_4_20_4_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_4_20_4_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_4_28_4_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_4_28_4_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@surface_graph.snap new file mode 100644 index 000000000000..d19d8f1dd48e --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multi_detuple@surface_graph.snap @@ -0,0 +1,20 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints1); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row_untuple : (_ , _ ,) | (row_untuple . 0 . 0 , row_untuple . 0 . 1 , row_untuple . 1 ,)); +10v1 = map (| row_untuple : (_ , _ , _ ,) | (row_untuple . 0 , row_untuple . 1 , row_untuple . 2 . 0 , row_untuple . 2 . 1 ,)); +11v1 = map (| row : (_ , _ , _ , _ ,) | ((row . 0 , row . 1 , row . 2 , row . 3 ,) , ())); +12v1 = map (| (g , a) : ((_ , _ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 , g . 3 ,)); + +7v1 -> 2v1; +12v1 -> 5v1; +5v1 -> 8v1; +9v1 -> 10v1; +2v1 -> 9v1; +11v1 -> 12v1; +10v1 -> 11v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@datalog_program.snap new file mode 100644 index 000000000000..151506633b4e --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@datalog_program.snap @@ -0,0 +1,547 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"union ()\"},\"version\":1},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (in1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (in2)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 , row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":7,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":7,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":7,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":\"out_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_10v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_1v1_node_11v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in2) + }; + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_10v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_10v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__source_stream__loc_nopath_2_24_2_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__source_stream__loc_nopath_2_24_2_42(op_10v1) + }; + let op_2v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_22(op_2v1) + }; + let op_11v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_11v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__source_stream__loc_nopath_3_24_3_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__source_stream__loc_nopath_3_24_3_42(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_22(op_5v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = op_2v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_5v1.map(|row: (_, _)| ((row.1, row.0), ())); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_1_0_1_0(op_15v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = op_15v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_1_0_1_0(op_16v1) + }; + let op_7v1 = { + #[allow(unused)] + #[inline(always)] + fn check_inputs< + A: ::std::iter::Iterator, + B: ::std::iter::Iterator, + Item, + >(a: A, b: B) -> impl ::std::iter::Iterator { + a.chain(b) + } + check_inputs(op_14v1, op_16v1) + }; + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__union__loc_nopath_4_20_4_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__union__loc_nopath_4_20_4_23(op_7v1) + }; + let op_8v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_4_20_4_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_4_20_4_23(op_8v1) + }; + let op_12v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__for_each__loc_nopath_4_25_4_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__for_each__loc_nopath_4_25_4_59(op_12v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_8v1, op_12v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@surface_graph.snap new file mode 100644 index 000000000000..502b61725fe0 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__multiple_contributors@surface_graph.snap @@ -0,0 +1,26 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = union (); +8v1 = unique :: < 'tick > (); +10v1 = source_stream (in1); +11v1 = source_stream (in2); +12v1 = for_each (| v | out . send (v) . unwrap ()); +13v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +14v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); +15v1 = map (| row : (_ , _ ,) | ((row . 1 , row . 0 ,) , ())); +16v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +10v1 -> 2v1; +11v1 -> 5v1; +7v1 -> 8v1; +8v1 -> 12v1; +14v1 -> 7v1; +13v1 -> 14v1; +2v1 -> 13v1; +16v1 -> 7v1; +15v1 -> 16v1; +5v1 -> 15v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@datalog_program.snap new file mode 100644 index 000000000000..a1b755eec027 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@datalog_program.snap @@ -0,0 +1,315 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (strings)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 . clone () , row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"strings_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(strings) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_28_2_50< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_28_2_50(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_26(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_9v1 = op_2v1.map(|row: (_,)| ((row.0.clone(), row.0), ())); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__map__loc_nopath_1_0_1_0(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + let op_5v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@surface_graph.snap new file mode 100644 index 000000000000..182918123c11 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__non_copy_but_clone@surface_graph.snap @@ -0,0 +1,16 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (strings); +8v1 = for_each (| v | result . send (v) . unwrap ()); +9v1 = map (| row : (_ ,) | ((row . 0 . clone () , row . 0 ,) , ())); +10v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +10v1 -> 5v1; +5v1 -> 8v1; +9v1 -> 10v1; +2v1 -> 9v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@datalog_program.snap new file mode 100644 index 000000000000..7f0bbf10d379 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@datalog_program.snap @@ -0,0 +1,2996 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"difference :: < 'tick , 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"difference :: < 'tick , 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"difference :: < 'tick , 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints2)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints3)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result2 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result3 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result4 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'static , 'static , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : (() , ((_ ,) , (_ ,))) | (kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (() , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (() , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'static , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : (() , ((_ , _ ,) , (_ ,))) | (kv . 1 . 0 . 0 , kv . 1 . 0 . 1 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | (() , (_v . 0 , _v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (() , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ , _ ,) | ((row . 0 , row . 1 , row . 2 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"anti_join ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ()) | (kv . 0 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"persist :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | ((_v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"persist :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | (_v . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"persist :: < 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"persist :: < 'static > ()\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":34,\"version\":1},{\"idx\":14,\"version\":3}],\"version\":5},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":28,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":25,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":35,\"version\":1},{\"idx\":11,\"version\":3}],\"version\":5},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":22,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":19,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":36,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":5},{\"value\":[{\"idx\":13,\"version\":3},{\"idx\":33,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":50,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":3},{\"idx\":31,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":58,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":19,\"version\":3},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":63,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":22,\"version\":3},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":68,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":25,\"version\":3},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":61,\"version\":1},{\"idx\":27,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":28,\"version\":3},{\"idx\":3,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":65,\"version\":1},{\"idx\":30,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":31,\"version\":1},{\"idx\":32,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":30,\"version\":1},{\"idx\":31,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":33,\"version\":1},{\"idx\":16,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":32,\"version\":1},{\"idx\":13,\"version\":3}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":11,\"version\":3},{\"idx\":7,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":37,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":38,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":39,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":40,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":41,\"version\":1},{\"idx\":42,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":43,\"version\":1},{\"idx\":41,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":29,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":44,\"version\":1},{\"idx\":41,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":26,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":45,\"version\":1},{\"idx\":46,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":47,\"version\":1},{\"idx\":45,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":42,\"version\":1},{\"idx\":47,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":48,\"version\":1},{\"idx\":45,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":48,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":14,\"version\":3},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":49,\"version\":1},{\"idx\":50,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":46,\"version\":1},{\"idx\":49,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":51,\"version\":1},{\"idx\":52,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":54,\"version\":1},{\"idx\":51,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":53,\"version\":1},{\"idx\":54,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":23,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":56,\"version\":1},{\"idx\":20,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":55,\"version\":1},{\"idx\":56,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":55,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":3},{\"idx\":65,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":57,\"version\":1},{\"idx\":58,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":52,\"version\":1},{\"idx\":57,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":26,\"version\":3},{\"idx\":44,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":60,\"version\":1},{\"idx\":61,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":59,\"version\":1},{\"idx\":60,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":59,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":20,\"version\":3},{\"idx\":51,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":62,\"version\":1},{\"idx\":63,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":27,\"version\":1},{\"idx\":62,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":29,\"version\":3},{\"idx\":43,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":64,\"version\":1},{\"idx\":17,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":64,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":23,\"version\":3},{\"idx\":53,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":67,\"version\":1},{\"idx\":68,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":66,\"version\":1},{\"idx\":67,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":32,\"version\":1},{\"idx\":66,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"2\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"3\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":8,\"version\":1},\"version\":1},{\"value\":{\"idx\":8,\"version\":1},\"version\":1},{\"value\":{\"idx\":8,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":9,\"version\":1},\"version\":1},{\"value\":{\"idx\":10,\"version\":1},\"version\":1},{\"value\":{\"idx\":11,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":8,\"version\":1},\"version\":1},{\"value\":{\"idx\":8,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1},{\"value\":{\"idx\":7,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":5,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":33,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":43,\"version\":1},{\"idx\":44,\"version\":1},{\"idx\":41,\"version\":1},{\"idx\":42,\"version\":1},{\"idx\":47,\"version\":1},{\"idx\":48,\"version\":1},{\"idx\":45,\"version\":1},{\"idx\":46,\"version\":1},{\"idx\":49,\"version\":1},{\"idx\":50,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":37,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":53,\"version\":1},{\"idx\":54,\"version\":1},{\"idx\":51,\"version\":1},{\"idx\":52,\"version\":1},{\"idx\":57,\"version\":1},{\"idx\":58,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":38,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1},{\"idx\":4,\"version\":1},{\"idx\":59,\"version\":1},{\"idx\":60,\"version\":1},{\"idx\":61,\"version\":1},{\"idx\":27,\"version\":1},{\"idx\":62,\"version\":1},{\"idx\":63,\"version\":1},{\"idx\":21,\"version\":1},{\"idx\":39,\"version\":1},{\"idx\":64,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":65,\"version\":1},{\"idx\":30,\"version\":1},{\"idx\":31,\"version\":1},{\"idx\":32,\"version\":1},{\"idx\":66,\"version\":1},{\"idx\":67,\"version\":1},{\"idx\":68,\"version\":1},{\"idx\":24,\"version\":1},{\"idx\":40,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":55,\"version\":1},{\"idx\":56,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":34,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":35,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":36,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":1,\"version\":1},{\"value\":2,\"version\":1},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":\"ints1\",\"version\":1},{\"value\":\"ints1\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints2_insert\",\"version\":1},{\"value\":\"ints2\",\"version\":1},{\"value\":\"ints2\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints3_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result3_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result4_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"intermediate_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"intermediate_persist_insert\",\"version\":1},{\"value\":\"intermediate_persist\",\"version\":1},{\"value\":\"intermediate_persist\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_4\",\"version\":1},{\"value\":\"join_4\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_7\",\"version\":1},{\"value\":\"join_7\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_11v3_send, hoff_11v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(11v3)"); + let (hoff_13v3_send, hoff_13v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(13v3)"); + let (hoff_14v3_send, hoff_14v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(14v3)"); + let (hoff_16v3_send, hoff_16v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(16v3)"); + let (hoff_17v3_send, hoff_17v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(17v3)"); + let (hoff_19v3_send, hoff_19v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(19v3)"); + let (hoff_20v3_send, hoff_20v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(20v3)"); + let (hoff_22v3_send, hoff_22v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(22v3)"); + let (hoff_23v3_send, hoff_23v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(23v3)"); + let (hoff_25v3_send, hoff_25v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(25v3)"); + let (hoff_26v3_send, hoff_26v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(26v3)"); + let (hoff_28v3_send, hoff_28v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(28v3)"); + let (hoff_29v3_send, hoff_29v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(29v3)"); + let mut sg_9v1_node_34v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let mut sg_10v1_node_35v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints2) + }; + let mut sg_11v1_node_36v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints3) + }; + let sg_4v1_node_12v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_4v1_node_41v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + let sg_4v1_node_41v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + let sg_4v1_node_45v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + let sg_4v1_node_45v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_4v1_node_45v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_4v1_node_15v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let singleton_op_53v1 = df + .add_state(::std::cell::RefCell::new(::std::vec::Vec::new())); + let sg_5v1_node_51v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_5v1_node_51v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_5v1_node_18v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_6v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_6v1_node_3v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new(hydroflow::rustc_hash::FxHashSet::default()), + ); + let sg_6v1_node_3v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_6v1_node_21v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_6v1_node_27v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let singleton_op_61v1 = df + .add_state(::std::cell::RefCell::new(::std::vec::Vec::new())); + let sg_7v1_node_30v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_7v1_node_31v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new(hydroflow::rustc_hash::FxHashSet::default()), + ); + let sg_7v1_node_31v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_7v1_node_24v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let singleton_op_68v1 = df + .add_state(::std::cell::RefCell::new(::std::vec::Vec::new())); + let sg_8v1_node_7v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_8v1_node_8v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new(hydroflow::rustc_hash::FxHashSet::default()), + ); + let sg_8v1_node_8v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let singleton_op_55v1 = df + .add_state(::std::cell::RefCell::new(::std::vec::Vec::new())); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(9v1)", + 0, + var_expr!(), + var_expr!(hoff_14v3_send), + false, + move |context, var_args!(), var_args!(hoff_14v3_send)| { + let hoff_14v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_14v3_send.give(Some(v)); + }); + let op_34v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_9v1_node_34v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_34v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_34v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_34v1__source_stream__loc_nopath_2_26_2_46(op_34v1) + }; + #[inline(always)] + fn pivot_run_sg_9v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_9v1(op_34v1, hoff_14v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(10v1)", + 0, + var_expr!(), + var_expr!(hoff_11v3_send), + false, + move |context, var_args!(), var_args!(hoff_11v3_send)| { + let hoff_11v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_11v3_send.give(Some(v)); + }); + let op_35v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_10v1_node_35v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_35v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_35v1__source_stream__loc_nopath_5_26_5_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_35v1__source_stream__loc_nopath_5_26_5_46(op_35v1) + }; + #[inline(always)] + fn pivot_run_sg_10v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_10v1(op_35v1, hoff_11v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(11v1)", + 0, + var_expr!(), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_6v3_send)| { + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_36v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_11v1_node_36v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_36v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_36v1__source_stream__loc_nopath_8_26_8_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_36v1__source_stream__loc_nopath_8_26_8_46(op_36v1) + }; + #[inline(always)] + fn pivot_run_sg_11v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_11v1(op_36v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(hoff_25v3_recv), + var_expr!(hoff_28v3_send), + false, + move |context, var_args!(hoff_25v3_recv), var_args!(hoff_28v3_send)| { + let mut hoff_25v3_recv = hoff_25v3_recv.borrow_mut_swap(); + let hoff_25v3_recv = hoff_25v3_recv.drain(..); + let hoff_28v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_28v3_send.give(Some(v)); + }); + let op_5v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_25v3_recv) + }; + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__defer_tick__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__defer_tick__loc_nopath_2_19_2_24(op_5v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, hoff_28v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(hoff_19v3_recv), + var_expr!(hoff_22v3_send), + false, + move |context, var_args!(hoff_19v3_recv), var_args!(hoff_22v3_send)| { + let mut hoff_19v3_recv = hoff_19v3_recv.borrow_mut_swap(); + let hoff_19v3_recv = hoff_19v3_recv.drain(..); + let hoff_22v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_22v3_send.give(Some(v)); + }); + let op_10v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_19v3_recv) + }; + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__defer_tick__loc_nopath_5_19_5_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__defer_tick__loc_nopath_5_19_5_24(op_10v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_10v1, hoff_22v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(3v1)", + 0, + var_expr!(hoff_13v3_recv), + var_expr!(hoff_16v3_send), + false, + move |context, var_args!(hoff_13v3_recv), var_args!(hoff_16v3_send)| { + let mut hoff_13v3_recv = hoff_13v3_recv.borrow_mut_swap(); + let hoff_13v3_recv = hoff_13v3_recv.drain(..); + let hoff_16v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_16v3_send.give(Some(v)); + }); + let op_33v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_13v3_recv) + }; + let op_33v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_33v1__defer_tick__loc_nopath_21_21_21_41< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_33v1__defer_tick__loc_nopath_21_21_21_41(op_33v1) + }; + #[inline(always)] + fn pivot_run_sg_3v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_3v1(op_33v1, hoff_16v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(4v1)", + 1, + var_expr!(hoff_6v3_recv, hoff_26v3_recv, hoff_29v3_recv), + var_expr!(), + false, + move | + context, + var_args!(hoff_6v3_recv, hoff_26v3_recv, hoff_29v3_recv), + var_args!()| + { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut hoff_26v3_recv = hoff_26v3_recv.borrow_mut_swap(); + let hoff_26v3_recv = hoff_26v3_recv.drain(..); + let mut hoff_29v3_recv = hoff_29v3_recv.borrow_mut_swap(); + let hoff_29v3_recv = hoff_29v3_recv.drain(..); + let op_12v1 = hoff_6v3_recv + .filter(|item| { + let mut borrow = context + .state_ref(sg_4v1_node_12v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__unique__loc_nopath_8_19_8_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__unique__loc_nopath_8_19_8_24(op_12v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_43v1 = hoff_29v3_recv.map(|_v: (_,)| ((), (_v.0,))); + let op_43v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_43v1__map__loc_nopath_15_31_15_39< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_43v1__map__loc_nopath_15_31_15_39(op_43v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_44v1 = hoff_26v3_recv.map(|_v: (_,)| ((), (_v.0,))); + let op_44v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_44v1__map__loc_nopath_15_41_15_49< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_44v1__map__loc_nopath_15_41_15_49(op_44v1) + }; + let mut sg_4v1_node_41v1_joindata_lhs_borrow = context + .state_ref(sg_4v1_node_41v1_joindata_lhs) + .borrow_mut(); + let mut sg_4v1_node_41v1_joindata_rhs_borrow = context + .state_ref(sg_4v1_node_41v1_joindata_rhs) + .borrow_mut(); + let op_41v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_43v1, + op_44v1, + &mut *sg_4v1_node_41v1_joindata_lhs_borrow, + &mut *sg_4v1_node_41v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_41v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_41v1__join__loc_nopath_15_12_15_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_41v1__join__loc_nopath_15_12_15_59(op_41v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_42v1 = op_41v1 + .map(|kv: ((), ((_,), (_,)))| (kv.1.0.0, kv.1.1.0)); + let op_42v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_42v1__map__loc_nopath_15_12_15_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_42v1__map__loc_nopath_15_12_15_59(op_42v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_47v1 = op_42v1.map(|_v: (_, _)| ((), (_v.0, _v.1))); + let op_47v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_47v1__map__loc_nopath_15_31_15_49< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_47v1__map__loc_nopath_15_31_15_49(op_47v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_48v1 = op_12v1.map(|_v: (_,)| ((), (_v.0,))); + let op_48v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_48v1__map__loc_nopath_15_51_15_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_48v1__map__loc_nopath_15_51_15_59(op_48v1) + }; + let mut sg_4v1_node_45v1_joindata_lhs_borrow = context + .state_ref(sg_4v1_node_45v1_joindata_lhs) + .borrow_mut(); + let mut sg_4v1_node_45v1_joindata_rhs_borrow = context + .state_ref(sg_4v1_node_45v1_joindata_rhs) + .borrow_mut(); + let op_45v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_47v1, + op_48v1, + &mut *sg_4v1_node_45v1_joindata_lhs_borrow, + &mut *sg_4v1_node_45v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_45v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_45v1__join__loc_nopath_15_12_15_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_45v1__join__loc_nopath_15_12_15_59(op_45v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_46v1 = op_45v1 + .map(|kv: ((), ((_, _), (_,)))| (kv.1.0.0, kv.1.0.1, kv.1.1.0)); + let op_46v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_46v1__map__loc_nopath_15_12_15_59< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_46v1__map__loc_nopath_15_12_15_59(op_46v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_49v1 = op_46v1 + .map(|row: (_, _, _)| ((row.0, row.1, row.2), ())); + let op_49v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_49v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_49v1__map__loc_nopath_1_0_1_0(op_49v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_50v1 = op_49v1.map(|(g, a): ((_, _, _), _)| (g.0, g.1, g.2)); + let op_50v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_50v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_50v1__map__loc_nopath_1_0_1_0(op_50v1) + }; + let op_15v1 = op_50v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_4v1_node_15v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__unique__loc_nopath_10_20_10_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__unique__loc_nopath_10_20_10_26(op_15v1) + }; + let op_37v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_37v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_37v1__for_each__loc_nopath_10_28_10_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_37v1__for_each__loc_nopath_10_28_10_65(op_37v1) + }; + #[inline(always)] + fn pivot_run_sg_4v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_4v1(op_15v1, op_37v1); + context.schedule_subgraph(context.current_subgraph(), false); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(5v1)", + 2, + var_expr!(hoff_20v3_recv, hoff_23v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_20v3_recv, hoff_23v3_recv), var_args!()| { + let mut hoff_20v3_recv = hoff_20v3_recv.borrow_mut_swap(); + let hoff_20v3_recv = hoff_20v3_recv.drain(..); + let mut hoff_23v3_recv = hoff_23v3_recv.borrow_mut_swap(); + let hoff_23v3_recv = hoff_23v3_recv.drain(..); + let mut sg_5v1_node_53v1_persistvec = context + .state_ref(singleton_op_53v1) + .borrow_mut(); + let op_53v1 = { + if context.is_first_run_this_tick() { + sg_5v1_node_53v1_persistvec.extend(hoff_23v3_recv); + sg_5v1_node_53v1_persistvec.iter().cloned() + } else { + let len = sg_5v1_node_53v1_persistvec.len(); + sg_5v1_node_53v1_persistvec.extend(hoff_23v3_recv); + sg_5v1_node_53v1_persistvec[len..].iter().cloned() + } + }; + let op_53v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_53v1__persist__loc_nopath_16_26_16_34< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_53v1__persist__loc_nopath_16_26_16_34(op_53v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_54v1 = op_53v1.map(|_v: (_,)| ((_v.0,), ())); + let op_54v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_54v1__map__loc_nopath_16_26_16_34< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_54v1__map__loc_nopath_16_26_16_34(op_54v1) + }; + let mut sg_5v1_node_51v1_antijoindata_neg_borrow = context + .state_ref(sg_5v1_node_51v1_antijoindata_neg) + .borrow_mut(); + let mut sg_5v1_node_51v1_antijoindata_pos_borrow = context + .state_ref(sg_5v1_node_51v1_antijoindata_pos) + .borrow_mut(); + let op_51v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_20v3_recv, + op_54v1, + &mut *sg_5v1_node_51v1_antijoindata_neg_borrow + .get_mut_clear(context.current_tick()), + &mut *sg_5v1_node_51v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_51v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_51v1__anti_join__loc_nopath_16_12_16_45< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_51v1__anti_join__loc_nopath_16_12_16_45(op_51v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_52v1 = op_51v1.map(|kv: ((_,), ())| (kv.0.0,)); + let op_52v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_52v1__map__loc_nopath_16_12_16_45< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_52v1__map__loc_nopath_16_12_16_45(op_52v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_57v1 = op_52v1.map(|row: (_,)| ((row.0,), ())); + let op_57v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_57v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_57v1__map__loc_nopath_1_0_1_0(op_57v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_58v1 = op_57v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_58v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_58v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_58v1__map__loc_nopath_1_0_1_0(op_58v1) + }; + let op_18v1 = op_58v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_5v1_node_18v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__unique__loc_nopath_11_20_11_27< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__unique__loc_nopath_11_20_11_27(op_18v1) + }; + let op_38v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result2.send(v).unwrap() + }); + let op_38v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_38v1__for_each__loc_nopath_11_29_11_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_38v1__for_each__loc_nopath_11_29_11_67(op_38v1) + }; + #[inline(always)] + fn pivot_run_sg_5v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_5v1(op_18v1, op_38v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(6v1)", + 1, + var_expr!(hoff_14v3_recv, hoff_28v3_recv), + var_expr!( + hoff_17v3_send, hoff_23v3_send, hoff_25v3_send, hoff_29v3_send + ), + false, + move | + context, + var_args!(hoff_14v3_recv, hoff_28v3_recv), + var_args!( + hoff_17v3_send, hoff_23v3_send, hoff_25v3_send, hoff_29v3_send + )| + { + let mut hoff_14v3_recv = hoff_14v3_recv.borrow_mut_swap(); + let hoff_14v3_recv = hoff_14v3_recv.drain(..); + let mut hoff_28v3_recv = hoff_28v3_recv.borrow_mut_swap(); + let hoff_28v3_recv = hoff_28v3_recv.drain(..); + let hoff_17v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_17v3_send.give(Some(v)); + }); + let hoff_23v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_23v3_send.give(Some(v)); + }); + let hoff_25v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_25v3_send.give(Some(v)); + }); + let hoff_29v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_29v3_send.give(Some(v)); + }); + let op_2v1 = hoff_14v3_recv + .filter(|item| { + let mut borrow = context + .state_ref(sg_6v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_2v1 = op_2v1.map(|k| (k, ())); + let mut sg_6v1_node_3v1_antijoindata_neg_borrow = context + .state_ref(sg_6v1_node_3v1_antijoindata_neg) + .borrow_mut(); + let mut sg_6v1_node_3v1_antijoindata_pos_borrow = context + .state_ref(sg_6v1_node_3v1_antijoindata_pos) + .borrow_mut(); + let op_3v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_28v3_recv, + op_2v1, + &mut *sg_6v1_node_3v1_antijoindata_neg_borrow, + &mut *sg_6v1_node_3v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_3v1 = op_3v1.map(|(k, ())| k); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__difference__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_3v1__difference__loc_nopath_2_19_2_24(op_3v1) + }; + let op_64v1 = hydroflow::pusherator::map::Map::new( + |row: (_,)| ((row.0,), ()), + hoff_17v3_send, + ); + let op_64v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_64v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_64v1__map__loc_nopath_1_0_1_0(op_64v1) + }; + let op_39v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result3.send(v).unwrap() + }); + let op_39v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_39v1__for_each__loc_nopath_12_29_12_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_39v1__for_each__loc_nopath_12_29_12_67(op_39v1) + }; + let op_21v1 = hydroflow::pusherator::filter::Filter::new( + |item| { + let mut borrow = context + .state_ref(sg_6v1_node_21v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }, + op_39v1, + ); + let op_21v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_21v1__unique__loc_nopath_12_20_12_27< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_21v1__unique__loc_nopath_12_20_12_27(op_21v1) + }; + let op_63v1 = hydroflow::pusherator::map::Map::new( + |(g, a): ((_,), _)| (g.0,), + op_21v1, + ); + let op_63v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_63v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_63v1__map__loc_nopath_1_0_1_0(op_63v1) + }; + let op_62v1 = hydroflow::pusherator::map::Map::new( + |row: (_,)| ((row.0,), ()), + op_63v1, + ); + let op_62v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_62v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_62v1__map__loc_nopath_1_0_1_0(op_62v1) + }; + let op_27v1 = hydroflow::pusherator::filter::Filter::new( + |item| { + let mut borrow = context + .state_ref(sg_6v1_node_27v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }, + op_62v1, + ); + let op_27v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_27v1__unique__loc_nopath_18_12_18_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_27v1__unique__loc_nopath_18_12_18_24(op_27v1) + }; + let mut sg_6v1_node_61v1_persistvec = context + .state_ref(singleton_op_61v1) + .borrow_mut(); + let op_61v1 = { + fn constrain_types<'ctx, Push, Item>( + vec: &'ctx mut Vec, + mut output: Push, + is_new_tick: bool, + ) -> impl 'ctx + hydroflow::pusherator::Pusherator + where + Push: 'ctx + hydroflow::pusherator::Pusherator, + Item: ::std::clone::Clone, + { + if is_new_tick { + vec.iter() + .cloned() + .for_each(|item| { + hydroflow::pusherator::Pusherator::give(&mut output, item); + }); + } + hydroflow::pusherator::map::Map::new( + |item| { + vec.push(item); + vec.last().unwrap().clone() + }, + output, + ) + } + constrain_types( + &mut *sg_6v1_node_61v1_persistvec, + op_27v1, + context.is_first_run_this_tick(), + ) + }; + let op_61v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_61v1__persist__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_61v1__persist__loc_nopath_1_0_1_0(op_61v1) + }; + let op_60v1 = hydroflow::pusherator::map::Map::new( + |(g, a): ((_,), _)| (g.0,), + op_61v1, + ); + let op_60v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_60v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_60v1__map__loc_nopath_1_0_1_0(op_60v1) + }; + let op_59v1 = hydroflow::pusherator::map::Map::new( + |row: (_,)| ((row.0,), ()), + op_60v1, + ); + let op_59v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_59v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_59v1__map__loc_nopath_1_0_1_0(op_59v1) + }; + let op_4v1 = hydroflow::pusherator::tee::Tee::new( + hoff_29v3_send, + hydroflow::pusherator::tee::Tee::new( + hoff_23v3_send, + hydroflow::pusherator::tee::Tee::new( + op_59v1, + hydroflow::pusherator::tee::Tee::new( + op_64v1, + hoff_25v3_send, + ), + ), + ), + ); + let op_4v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_4v1__tee__loc_nopath_2_19_2_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_4v1__tee__loc_nopath_2_19_2_24(op_4v1) + }; + #[inline(always)] + fn pivot_run_sg_6v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_6v1(op_3v1, op_4v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(7v1)", + 1, + var_expr!(hoff_16v3_recv, hoff_17v3_recv), + var_expr!(hoff_13v3_send), + false, + move | + context, + var_args!(hoff_16v3_recv, hoff_17v3_recv), + var_args!(hoff_13v3_send)| + { + let mut hoff_16v3_recv = hoff_16v3_recv.borrow_mut_swap(); + let hoff_16v3_recv = hoff_16v3_recv.drain(..); + let mut hoff_17v3_recv = hoff_17v3_recv.borrow_mut_swap(); + let hoff_17v3_recv = hoff_17v3_recv.drain(..); + let hoff_13v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_13v3_send.give(Some(v)); + }); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_65v1 = hoff_17v3_recv.map(|(g, a): ((_,), _)| (g.0,)); + let op_65v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_65v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_65v1__map__loc_nopath_1_0_1_0(op_65v1) + }; + let op_30v1 = op_65v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_7v1_node_30v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_30v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_30v1__unique__loc_nopath_21_21_21_41< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_30v1__unique__loc_nopath_21_21_21_41(op_30v1) + }; + let op_30v1 = op_30v1.map(|k| (k, ())); + let mut sg_7v1_node_31v1_antijoindata_neg_borrow = context + .state_ref(sg_7v1_node_31v1_antijoindata_neg) + .borrow_mut(); + let mut sg_7v1_node_31v1_antijoindata_pos_borrow = context + .state_ref(sg_7v1_node_31v1_antijoindata_pos) + .borrow_mut(); + let op_31v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_16v3_recv, + op_30v1, + &mut *sg_7v1_node_31v1_antijoindata_neg_borrow, + &mut *sg_7v1_node_31v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_31v1 = op_31v1.map(|(k, ())| k); + let op_31v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_31v1__difference__loc_nopath_21_21_21_41< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_31v1__difference__loc_nopath_21_21_21_41(op_31v1) + }; + let op_40v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result4.send(v).unwrap() + }); + let op_40v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_40v1__for_each__loc_nopath_13_29_13_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_40v1__for_each__loc_nopath_13_29_13_67(op_40v1) + }; + let op_24v1 = hydroflow::pusherator::filter::Filter::new( + |item| { + let mut borrow = context + .state_ref(sg_7v1_node_24v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }, + op_40v1, + ); + let op_24v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_24v1__unique__loc_nopath_13_20_13_27< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_24v1__unique__loc_nopath_13_20_13_27(op_24v1) + }; + let mut sg_7v1_node_68v1_persistvec = context + .state_ref(singleton_op_68v1) + .borrow_mut(); + let op_68v1 = { + fn constrain_types<'ctx, Push, Item>( + vec: &'ctx mut Vec, + mut output: Push, + is_new_tick: bool, + ) -> impl 'ctx + hydroflow::pusherator::Pusherator + where + Push: 'ctx + hydroflow::pusherator::Pusherator, + Item: ::std::clone::Clone, + { + if is_new_tick { + vec.iter() + .cloned() + .for_each(|item| { + hydroflow::pusherator::Pusherator::give(&mut output, item); + }); + } + hydroflow::pusherator::map::Map::new( + |item| { + vec.push(item); + vec.last().unwrap().clone() + }, + output, + ) + } + constrain_types( + &mut *sg_7v1_node_68v1_persistvec, + op_24v1, + context.is_first_run_this_tick(), + ) + }; + let op_68v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_68v1__persist__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_68v1__persist__loc_nopath_1_0_1_0(op_68v1) + }; + let op_67v1 = hydroflow::pusherator::map::Map::new( + |(g, a): ((_,), _)| (g.0,), + op_68v1, + ); + let op_67v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_67v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_67v1__map__loc_nopath_1_0_1_0(op_67v1) + }; + let op_66v1 = hydroflow::pusherator::map::Map::new( + |row: (_,)| ((row.0,), ()), + op_67v1, + ); + let op_66v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_66v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_66v1__map__loc_nopath_1_0_1_0(op_66v1) + }; + let op_32v1 = hydroflow::pusherator::tee::Tee::new( + op_66v1, + hoff_13v3_send, + ); + let op_32v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_32v1__tee__loc_nopath_21_21_21_41< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_32v1__tee__loc_nopath_21_21_21_41(op_32v1) + }; + #[inline(always)] + fn pivot_run_sg_7v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_7v1(op_31v1, op_32v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(8v1)", + 1, + var_expr!(hoff_11v3_recv, hoff_22v3_recv), + var_expr!(hoff_19v3_send, hoff_20v3_send, hoff_26v3_send), + false, + move | + context, + var_args!(hoff_11v3_recv, hoff_22v3_recv), + var_args!(hoff_19v3_send, hoff_20v3_send, hoff_26v3_send)| + { + let mut hoff_11v3_recv = hoff_11v3_recv.borrow_mut_swap(); + let hoff_11v3_recv = hoff_11v3_recv.drain(..); + let mut hoff_22v3_recv = hoff_22v3_recv.borrow_mut_swap(); + let hoff_22v3_recv = hoff_22v3_recv.drain(..); + let hoff_19v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_19v3_send.give(Some(v)); + }); + let hoff_20v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_20v3_send.give(Some(v)); + }); + let hoff_26v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_26v3_send.give(Some(v)); + }); + let op_7v1 = hoff_11v3_recv + .filter(|item| { + let mut borrow = context + .state_ref(sg_8v1_node_7v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__unique__loc_nopath_5_19_5_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__unique__loc_nopath_5_19_5_24(op_7v1) + }; + let op_7v1 = op_7v1.map(|k| (k, ())); + let mut sg_8v1_node_8v1_antijoindata_neg_borrow = context + .state_ref(sg_8v1_node_8v1_antijoindata_neg) + .borrow_mut(); + let mut sg_8v1_node_8v1_antijoindata_pos_borrow = context + .state_ref(sg_8v1_node_8v1_antijoindata_pos) + .borrow_mut(); + let op_8v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_22v3_recv, + op_7v1, + &mut *sg_8v1_node_8v1_antijoindata_neg_borrow, + &mut *sg_8v1_node_8v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_8v1 = op_8v1.map(|(k, ())| k); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__difference__loc_nopath_5_19_5_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__difference__loc_nopath_5_19_5_24(op_8v1) + }; + let op_56v1 = hydroflow::pusherator::map::Map::new( + |_v: (_,)| (_v.0,), + hoff_20v3_send, + ); + let op_56v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_56v1__map__loc_nopath_16_37_16_45< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_56v1__map__loc_nopath_16_37_16_45(op_56v1) + }; + let mut sg_8v1_node_55v1_persistvec = context + .state_ref(singleton_op_55v1) + .borrow_mut(); + let op_55v1 = { + fn constrain_types<'ctx, Push, Item>( + vec: &'ctx mut Vec, + mut output: Push, + is_new_tick: bool, + ) -> impl 'ctx + hydroflow::pusherator::Pusherator + where + Push: 'ctx + hydroflow::pusherator::Pusherator, + Item: ::std::clone::Clone, + { + if is_new_tick { + vec.iter() + .cloned() + .for_each(|item| { + hydroflow::pusherator::Pusherator::give(&mut output, item); + }); + } + hydroflow::pusherator::map::Map::new( + |item| { + vec.push(item); + vec.last().unwrap().clone() + }, + output, + ) + } + constrain_types( + &mut *sg_8v1_node_55v1_persistvec, + op_56v1, + context.is_first_run_this_tick(), + ) + }; + let op_55v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_55v1__persist__loc_nopath_16_37_16_45< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_55v1__persist__loc_nopath_16_37_16_45(op_55v1) + }; + let op_9v1 = hydroflow::pusherator::tee::Tee::new( + hoff_26v3_send, + hydroflow::pusherator::tee::Tee::new(op_55v1, hoff_19v3_send), + ); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__tee__loc_nopath_5_19_5_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_9v1__tee__loc_nopath_5_19_5_24(op_9v1) + }; + #[inline(always)] + fn pivot_run_sg_8v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_8v1(op_8v1, op_9v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@surface_graph.snap new file mode 100644 index 000000000000..e928aaefed1f --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist@surface_graph.snap @@ -0,0 +1,114 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = difference :: < 'tick , 'static > (); +4v1 = tee (); +5v1 = defer_tick (); +7v1 = unique :: < 'tick > (); +8v1 = difference :: < 'tick , 'static > (); +9v1 = tee (); +10v1 = defer_tick (); +12v1 = unique :: < 'tick > (); +15v1 = unique :: < 'tick > (); +18v1 = unique :: < 'tick > (); +21v1 = unique :: < 'tick > (); +24v1 = unique :: < 'tick > (); +27v1 = unique :: < 'tick > (); +30v1 = unique :: < 'tick > (); +31v1 = difference :: < 'tick , 'static > (); +32v1 = tee (); +33v1 = defer_tick (); +34v1 = source_stream (ints1); +35v1 = source_stream (ints2); +36v1 = source_stream (ints3); +37v1 = for_each (| v | result . send (v) . unwrap ()); +38v1 = for_each (| v | result2 . send (v) . unwrap ()); +39v1 = for_each (| v | result3 . send (v) . unwrap ()); +40v1 = for_each (| v | result4 . send (v) . unwrap ()); +41v1 = join :: < 'static , 'static , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +42v1 = map (| kv : (() , ((_ ,) , (_ ,))) | (kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,)); +43v1 = map (| _v : (_ ,) | (() , (_v . 0 ,))); +44v1 = map (| _v : (_ ,) | (() , (_v . 0 ,))); +45v1 = join :: < 'static , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +46v1 = map (| kv : (() , ((_ , _ ,) , (_ ,))) | (kv . 1 . 0 . 0 , kv . 1 . 0 . 1 , kv . 1 . 1 . 0 ,)); +47v1 = map (| _v : (_ , _ ,) | (() , (_v . 0 , _v . 1 ,))); +48v1 = map (| _v : (_ ,) | (() , (_v . 0 ,))); +49v1 = map (| row : (_ , _ , _ ,) | ((row . 0 , row . 1 , row . 2 ,) , ())); +50v1 = map (| (g , a) : ((_ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 ,)); +51v1 = anti_join (); +52v1 = map (| kv : ((_ ,) , ()) | (kv . 0 . 0 ,)); +53v1 = persist :: < 'static > (); +54v1 = map (| _v : (_ ,) | ((_v . 0 ,) , ())); +55v1 = persist :: < 'static > (); +56v1 = map (| _v : (_ ,) | (_v . 0 ,)); +57v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +58v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +59v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +60v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +61v1 = persist :: < 'static > (); +62v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +63v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +64v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +65v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +66v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +67v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +68v1 = persist :: < 'static > (); + +34v1 -> 2v1; +3v1 -> 4v1; +2v1 -> 3v1; +5v1 -> 3v1; +4v1 -> 5v1; +35v1 -> 7v1; +8v1 -> 9v1; +7v1 -> 8v1; +10v1 -> 8v1; +9v1 -> 10v1; +36v1 -> 12v1; +50v1 -> 15v1; +58v1 -> 18v1; +63v1 -> 21v1; +68v1 -> 24v1; +61v1 -> 27v1; +65v1 -> 30v1; +31v1 -> 32v1; +30v1 -> 31v1; +33v1 -> 31v1; +32v1 -> 33v1; +15v1 -> 37v1; +18v1 -> 38v1; +21v1 -> 39v1; +24v1 -> 40v1; +41v1 -> 42v1; +43v1 -> 41v1; +4v1 -> 43v1; +44v1 -> 41v1; +9v1 -> 44v1; +45v1 -> 46v1; +47v1 -> 45v1; +42v1 -> 47v1; +48v1 -> 45v1; +12v1 -> 48v1; +49v1 -> 50v1; +46v1 -> 49v1; +51v1 -> 52v1; +54v1 -> 51v1; +53v1 -> 54v1; +4v1 -> 53v1; +56v1 -> 51v1; +55v1 -> 56v1; +9v1 -> 55v1; +57v1 -> 58v1; +52v1 -> 57v1; +60v1 -> 61v1; +59v1 -> 60v1; +4v1 -> 59v1; +62v1 -> 63v1; +27v1 -> 62v1; +64v1 -> 65v1; +4v1 -> 64v1; +67v1 -> 68v1; +66v1 -> 67v1; +32v1 -> 66v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@datalog_program.snap new file mode 100644 index 000000000000..79468d88b767 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@datalog_program.snap @@ -0,0 +1,824 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"difference :: < 'tick , 'static > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"defer_tick ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints2)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | (() , ((row . 0) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'static , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : (() , _) | (a . 0 . unwrap () . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":4,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":11,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":8,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":5},{\"value\":[{\"idx\":8,\"version\":3},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":11,\"version\":3},{\"idx\":3,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":7,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":3},{\"idx\":17,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":9,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Path\":\"pos\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":5},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Path\":\"neg\"}],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":5,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1},{\"idx\":4,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":12,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":2,\"version\":1},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":\"ints1\",\"version\":1},{\"value\":\"ints1\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let (hoff_8v3_send, hoff_8v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(8v3)"); + let (hoff_9v3_send, hoff_9v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(9v3)"); + let (hoff_11v3_send, hoff_11v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(11v3)"); + let mut sg_4v1_node_12v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints2) + }; + let sg_2v1_node_17v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(), (Option<_>,)>::default(), + ), + ); + let sg_2v1_node_10v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_7v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_3v1_antijoindata_neg = df + .add_state( + std::cell::RefCell::new(hydroflow::rustc_hash::FxHashSet::default()), + ); + let sg_3v1_node_3v1_antijoindata_pos = df + .add_state( + std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(4v1)", + 0, + var_expr!(), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_6v3_send)| { + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_12v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_4v1_node_12v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__source_stream__loc_nopath_4_26_4_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__source_stream__loc_nopath_4_26_4_46(op_12v1) + }; + #[inline(always)] + fn pivot_run_sg_4v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_4v1(op_12v1, hoff_6v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(hoff_8v3_recv), + var_expr!(hoff_11v3_send), + false, + move |context, var_args!(hoff_8v3_recv), var_args!(hoff_11v3_send)| { + let mut hoff_8v3_recv = hoff_8v3_recv.borrow_mut_swap(); + let hoff_8v3_recv = hoff_8v3_recv.drain(..); + let hoff_11v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_11v3_send.give(Some(v)); + }); + let op_5v1 = { + fn check_input, Item>( + iter: Iter, + ) -> impl ::std::iter::Iterator { + iter + } + check_input::<_, _>(hoff_8v3_recv) + }; + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__defer_tick__loc_nopath_2_21_2_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__defer_tick__loc_nopath_2_21_2_26(op_5v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, hoff_11v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 2, + var_expr!(hoff_9v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_9v3_recv), var_args!()| { + let mut hoff_9v3_recv = hoff_9v3_recv.borrow_mut_swap(); + let hoff_9v3_recv = hoff_9v3_recv.drain(..); + let mut sg_2v1_node_17v1_hashtable = context + .state_ref(sg_2v1_node_17v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_9v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_2v1_node_17v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some({ + let prev: (hydroflow::rustc_hash::FxHashSet<_>, _) = prev; + let mut set: hydroflow::rustc_hash::FxHashSet<_> = prev.0; + if set.insert(val.0) { + (set, prev.1 + 1) + } else { + (set, prev.1) + } + }) + } else { + Some({ + let mut set = hydroflow::rustc_hash::FxHashSet::< + _, + >::default(); + set.insert(val.0); + (set, 1) + }) + }; + }, + ); + } + } + let op_17v1 = context + .is_first_run_this_tick() + .then_some(sg_2v1_node_17v1_hashtable.iter()) + .into_iter() + .flatten() + .map( + #[allow( + unknown_lints, + suspicious_double_ref_op, + clippy::clone_on_copy + )] + |(k, v)| ( + ::std::clone::Clone::clone(k), + ::std::clone::Clone::clone(v), + ), + ); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__fold_keyed__loc_nopath_1_0_1_0(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1.map(|(g, a): ((), _)| (a.0.unwrap().1,)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_1_0_1_0(op_18v1) + }; + let op_10v1 = op_18v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_10v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__unique__loc_nopath_8_20_8_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__unique__loc_nopath_8_20_8_26(op_10v1) + }; + let op_13v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__for_each__loc_nopath_8_28_8_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_13v1__for_each__loc_nopath_8_28_8_65(op_13v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_10v1, op_13v1); + context.schedule_subgraph(context.current_subgraph(), false); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(3v1)", + 1, + var_expr!(hoff_6v3_recv, hoff_11v3_recv), + var_expr!(hoff_8v3_send, hoff_9v3_send), + false, + move | + context, + var_args!(hoff_6v3_recv, hoff_11v3_recv), + var_args!(hoff_8v3_send, hoff_9v3_send)| + { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let mut hoff_11v3_recv = hoff_11v3_recv.borrow_mut_swap(); + let hoff_11v3_recv = hoff_11v3_recv.drain(..); + let hoff_8v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_8v3_send.give(Some(v)); + }); + let hoff_9v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_9v3_send.give(Some(v)); + }); + let op_7v1 = hoff_6v3_recv + .filter(|item| { + let mut borrow = context + .state_ref(sg_3v1_node_7v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__unique__loc_nopath_4_19_4_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__unique__loc_nopath_4_19_4_24(op_7v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_7v1.map(|row: (_,)| ((row.0,), ())); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_14v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_1_0_1_0(op_15v1) + }; + let op_2v1 = op_15v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_3v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_21_2_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_21_2_26(op_2v1) + }; + let op_2v1 = op_2v1.map(|k| (k, ())); + let mut sg_3v1_node_3v1_antijoindata_neg_borrow = context + .state_ref(sg_3v1_node_3v1_antijoindata_neg) + .borrow_mut(); + let mut sg_3v1_node_3v1_antijoindata_pos_borrow = context + .state_ref(sg_3v1_node_3v1_antijoindata_pos) + .borrow_mut(); + let op_3v1 = { + /// Limit error propagation by bounding locally, erasing output iterator type. + #[inline(always)] + fn check_inputs<'a, K, I1, V, I2>( + input_neg: I1, + input_pos: I2, + neg_state: &'a mut hydroflow::rustc_hash::FxHashSet, + pos_state: &'a mut hydroflow::rustc_hash::FxHashSet<(K, V)>, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + ::std::hash::Hash + Clone, + V: Eq + ::std::hash::Hash + Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + neg_state.extend(input_neg); + hydroflow::compiled::pull::anti_join_into_iter( + input_pos, + neg_state, + pos_state, + is_new_tick, + ) + } + check_inputs( + hoff_11v3_recv, + op_2v1, + &mut *sg_3v1_node_3v1_antijoindata_neg_borrow, + &mut *sg_3v1_node_3v1_antijoindata_pos_borrow + .get_mut_clear(context.current_tick()), + context.is_first_run_this_tick(), + ) + }; + let op_3v1 = op_3v1.map(|(k, ())| k); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__difference__loc_nopath_2_21_2_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_3v1__difference__loc_nopath_2_21_2_26(op_3v1) + }; + let op_16v1 = hydroflow::pusherator::map::Map::new( + |row: (_,)| ((), ((row.0),)), + hoff_9v3_send, + ); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_1_0_1_0< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_16v1__map__loc_nopath_1_0_1_0(op_16v1) + }; + let op_4v1 = hydroflow::pusherator::tee::Tee::new( + op_16v1, + hoff_8v3_send, + ); + let op_4v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_4v1__tee__loc_nopath_2_21_2_26< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_4v1__tee__loc_nopath_2_21_2_26(op_4v1) + }; + #[inline(always)] + fn pivot_run_sg_3v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_3v1(op_3v1, op_4v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@surface_graph.snap new file mode 100644 index 000000000000..a64146623be0 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__persist_uniqueness@surface_graph.snap @@ -0,0 +1,31 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = difference :: < 'tick , 'static > (); +4v1 = tee (); +5v1 = defer_tick (); +7v1 = unique :: < 'tick > (); +10v1 = unique :: < 'tick > (); +12v1 = source_stream (ints2); +13v1 = for_each (| v | result . send (v) . unwrap ()); +14v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +15v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +16v1 = map (| row : (_ ,) | (() , ((row . 0) ,))); +17v1 = fold_keyed :: < 'static , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; }); +18v1 = map (| (g , a) : (() , _) | (a . 0 . unwrap () . 1 ,)); + +15v1 -> 2v1; +3v1 -> 4v1; +2v1 -> 3v1; +5v1 -> 3v1; +4v1 -> 5v1; +12v1 -> 7v1; +18v1 -> 10v1; +10v1 -> 13v1; +14v1 -> 15v1; +7v1 -> 14v1; +17v1 -> 18v1; +16v1 -> 17v1; +4v1 -> 16v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@datalog_program.snap new file mode 100644 index 000000000000..b29abd51b761 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@datalog_program.snap @@ -0,0 +1,517 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (ints)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| (node , data) | async_send_result (node , data))\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (async_receive_result)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| v : (_ , _ ,) | (v . 1 , (v . 0 ,)))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":3}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result_async_send\",\"version\":1},{\"value\":\"result_async_send\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_12v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(async_receive_result) + }; + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_2v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints) + }; + let sg_2v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_2v1_node_10v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_12v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_12v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__source_stream__loc_nopath_4_84_4_119< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__source_stream__loc_nopath_4_84_4_119(op_12v1) + }; + let op_5v1 = op_12v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_26(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_28_3_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_28_3_65(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_25_2_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_25_2_44(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_23(op_2v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = op_2v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_14v1.map(|v: (_, _)| (v.1, (v.0,))); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_6_24_6_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_6_24_6_26(op_15v1) + }; + let op_10v1 = op_15v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_10v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__unique__loc_nopath_4_19_4_25< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__unique__loc_nopath_4_19_4_25(op_10v1) + }; + let op_11v1 = hydroflow::pusherator::for_each::ForEach::new(| + (node, data)| + async_send_result(node, data)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__for_each__loc_nopath_4_27_4_81< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_11v1__for_each__loc_nopath_4_27_4_81(op_11v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_10v1, op_11v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@surface_graph.snap new file mode 100644 index 000000000000..b87aaf28ebc6 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__send_to_node@surface_graph.snap @@ -0,0 +1,23 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (ints); +8v1 = for_each (| v | result . send (v) . unwrap ()); +10v1 = unique :: < 'tick > (); +11v1 = for_each (| (node , data) | async_send_result (node , data)); +12v1 = source_stream (async_receive_result); +13v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +14v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); +15v1 = map (| v : (_ , _ ,) | (v . 1 , (v . 0 ,))); + +7v1 -> 2v1; +12v1 -> 5v1; +5v1 -> 8v1; +10v1 -> 11v1; +15v1 -> 10v1; +14v1 -> 15v1; +13v1 -> 14v1; +2v1 -> 13v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@datalog_program.snap new file mode 100644 index 000000000000..6c30d8804f35 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@datalog_program.snap @@ -0,0 +1,349 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (input)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"filter (| row : & (_ , _ ,) | row . 0 > row . 1 && row . 1 == row . 0)\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"input_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"predicate_1_filter\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(input) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_9v1 = op_2v1 + .filter(|row: &(_, _)| row.0 > row.1 && row.1 == row.0); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__filter__loc_nopath_5_12_5_60< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__filter__loc_nopath_5_12_5_60(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1.map(|row: (_, _)| ((row.0, row.1), ())); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_1_0_1_0(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = op_10v1.map(|(g, a): ((_, _), _)| (g.0, g.1)); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_1_0_1_0(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_23(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_25_3_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_25_3_59(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@surface_graph.snap new file mode 100644 index 000000000000..6bdb3509821a --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__simple_filter@surface_graph.snap @@ -0,0 +1,18 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (input); +8v1 = for_each (| v | out . send (v) . unwrap ()); +9v1 = filter (| row : & (_ , _ ,) | row . 0 > row . 1 && row . 1 == row . 0); +10v1 = map (| row : (_ , _ ,) | ((row . 0 , row . 1 ,) , ())); +11v1 = map (| (g , a) : ((_ , _ ,) , _) | (g . 0 , g . 1 ,)); + +7v1 -> 2v1; +11v1 -> 5v1; +5v1 -> 8v1; +2v1 -> 9v1; +10v1 -> 11v1; +9v1 -> 10v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@datalog_program.snap new file mode 100644 index 000000000000..f1d464ba8c1b --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@datalog_program.snap @@ -0,0 +1,638 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (in1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (in2)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , (() , ())) | (kv . 0 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | ((_v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | ((_v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_10v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_1v1_node_11v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in2) + }; + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_13v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_13v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_13v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_13v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_10v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_10v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__source_stream__loc_nopath_2_24_2_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__source_stream__loc_nopath_2_24_2_42(op_10v1) + }; + let op_2v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_22(op_2v1) + }; + let op_11v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_11v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__source_stream__loc_nopath_3_24_3_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__source_stream__loc_nopath_3_24_3_42(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_22(op_5v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_15v1 = op_2v1.map(|_v: (_,)| ((_v.0,), ())); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__map__loc_nopath_6_22_6_28< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__map__loc_nopath_6_22_6_28(op_15v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = op_5v1.map(|_v: (_,)| ((_v.0,), ())); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_6_30_6_36< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_6_30_6_36(op_16v1) + }; + let mut sg_1v1_node_13v1_joindata_lhs_borrow = context + .state_ref(sg_1v1_node_13v1_joindata_lhs) + .borrow_mut(); + let mut sg_1v1_node_13v1_joindata_rhs_borrow = context + .state_ref(sg_1v1_node_13v1_joindata_rhs) + .borrow_mut(); + let op_13v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_15v1, + op_16v1, + &mut *sg_1v1_node_13v1_joindata_lhs_borrow, + &mut *sg_1v1_node_13v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__join__loc_nopath_6_12_6_37< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__join__loc_nopath_6_12_6_37(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|kv: ((_,), ((), ()))| (kv.0.0,)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_6_12_6_37< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_6_12_6_37(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_17v1 = op_14v1.map(|row: (_,)| ((row.0,), ())); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__map__loc_nopath_1_0_1_0(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_1_0_1_0(op_18v1) + }; + let op_8v1 = op_18v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_4_20_4_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_4_20_4_23(op_8v1) + }; + let op_12v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__for_each__loc_nopath_4_25_4_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__for_each__loc_nopath_4_25_4_59(op_12v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_8v1, op_12v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@surface_graph.snap new file mode 100644 index 000000000000..19eded519dc8 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__single_column_program@surface_graph.snap @@ -0,0 +1,28 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +10v1 = source_stream (in1); +11v1 = source_stream (in2); +12v1 = for_each (| v | out . send (v) . unwrap ()); +13v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +14v1 = map (| kv : ((_ ,) , (() , ())) | (kv . 0 . 0 ,)); +15v1 = map (| _v : (_ ,) | ((_v . 0 ,) , ())); +16v1 = map (| _v : (_ ,) | ((_v . 0 ,) , ())); +17v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +18v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); + +10v1 -> 2v1; +11v1 -> 5v1; +18v1 -> 8v1; +8v1 -> 12v1; +13v1 -> 14v1; +15v1 -> 13v1; +2v1 -> 15v1; +16v1 -> 13v1; +5v1 -> 16v1; +17v1 -> 18v1; +14v1 -> 17v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@datalog_program.snap new file mode 100644 index 000000000000..3584873bb0d5 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@datalog_program.snap @@ -0,0 +1,803 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"union ()\"},\"version\":1},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (edges)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (seed_reachable)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | reachable . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , (() , (_ ,))) | (kv . 0 . 0 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | ((_v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | ((row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":17,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":7,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":7,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":16,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":16,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1},{\"idx\":7,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":12,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"edges_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"seed_reachable_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"reachable_insert\",\"version\":1},{\"value\":\"reachable_insert\",\"version\":1},{\"value\":\"reachable\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_3\",\"version\":1},{\"value\":\"join_3\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let mut sg_1v1_node_10v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(edges) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_1v1_node_11v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(seed_reachable) + }; + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_15v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_15v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_15v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_15v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(hoff_6v3_recv), + var_expr!(hoff_6v3_send), + false, + move |context, var_args!(hoff_6v3_recv), var_args!(hoff_6v3_send)| { + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_10v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_10v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__source_stream__loc_nopath_2_26_2_46(op_10v1) + }; + let op_2v1 = op_10v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_11v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_11v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__source_stream__loc_nopath_3_35_3_64< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__source_stream__loc_nopath_3_35_3_64(op_11v1) + }; + let op_5v1 = op_11v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_33< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_33(op_5v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = op_5v1.map(|row: (_,)| ((row.0,), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_17v1 = hoff_6v3_recv.map(|_v: (_,)| ((_v.0,), ())); + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__map__loc_nopath_7_28_7_40< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__map__loc_nopath_7_28_7_40(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_2v1.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_7_42_7_53< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_7_42_7_53(op_18v1) + }; + let mut sg_1v1_node_15v1_joindata_lhs_borrow = context + .state_ref(sg_1v1_node_15v1_joindata_lhs) + .borrow_mut(); + let mut sg_1v1_node_15v1_joindata_rhs_borrow = context + .state_ref(sg_1v1_node_15v1_joindata_rhs) + .borrow_mut(); + let op_15v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_17v1, + op_18v1, + &mut *sg_1v1_node_15v1_joindata_lhs_borrow, + &mut *sg_1v1_node_15v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__join__loc_nopath_7_12_7_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__join__loc_nopath_7_12_7_54(op_15v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_16v1 = op_15v1 + .map(|kv: ((_,), ((), (_,)))| (kv.0.0, kv.1.1.0)); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__map__loc_nopath_7_12_7_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_16v1__map__loc_nopath_7_12_7_54(op_16v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = op_16v1.map(|row: (_, _)| ((row.1,), ())); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_1_0_1_0(op_19v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_20v1 = op_19v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__map__loc_nopath_1_0_1_0(op_20v1) + }; + let op_7v1 = { + #[allow(unused)] + #[inline(always)] + fn check_inputs< + A: ::std::iter::Iterator, + B: ::std::iter::Iterator, + Item, + >(a: A, b: B) -> impl ::std::iter::Iterator { + a.chain(b) + } + check_inputs(op_14v1, op_20v1) + }; + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__union__loc_nopath_4_20_4_29< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__union__loc_nopath_4_20_4_29(op_7v1) + }; + let op_8v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_4_20_4_29< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_4_20_4_29(op_8v1) + }; + let op_12v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + reachable.send(v).unwrap() + }); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__for_each__loc_nopath_4_31_4_71< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_12v1__for_each__loc_nopath_4_31_4_71(op_12v1) + }; + let op_9v1 = hydroflow::pusherator::tee::Tee::new( + op_12v1, + hoff_6v3_send, + ); + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__tee__loc_nopath_4_20_4_29< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_9v1__tee__loc_nopath_4_20_4_29(op_9v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_8v1, op_9v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@surface_graph.snap new file mode 100644 index 000000000000..eba476208122 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__transitive_closure@surface_graph.snap @@ -0,0 +1,37 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +7v1 = union (); +8v1 = unique :: < 'tick > (); +9v1 = tee (); +10v1 = source_stream (edges); +11v1 = source_stream (seed_reachable); +12v1 = for_each (| v | reachable . send (v) . unwrap ()); +13v1 = map (| row : (_ ,) | ((row . 0 ,) , ())); +14v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); +15v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +16v1 = map (| kv : ((_ ,) , (() , (_ ,))) | (kv . 0 . 0 , kv . 1 . 1 . 0 ,)); +17v1 = map (| _v : (_ ,) | ((_v . 0 ,) , ())); +18v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +19v1 = map (| row : (_ , _ ,) | ((row . 1 ,) , ())); +20v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); + +10v1 -> 2v1; +11v1 -> 5v1; +7v1 -> 8v1; +8v1 -> 9v1; +9v1 -> 12v1; +14v1 -> 7v1; +13v1 -> 14v1; +5v1 -> 13v1; +15v1 -> 16v1; +17v1 -> 15v1; +9v1 -> 17v1; +18v1 -> 15v1; +2v1 -> 18v1; +20v1 -> 7v1; +19v1 -> 20v1; +16v1 -> 19v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@datalog_program.snap new file mode 100644 index 000000000000..f7c05b0ce437 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@datalog_program.snap @@ -0,0 +1,970 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"source_stream (in1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (in2)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (in3)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ((_ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 1 ,) , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ((_ , _ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 0 . 1 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ , _ ,) | ((_v . 2 ,) , (_v . 1 , _v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ , _ , _ ,) | ((row . 3 , row . 0 , row . 2 , row . 1 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ , _ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 , g . 3 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":15,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":26,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":19,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":20,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":22,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":23,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":23,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":25,\"version\":1},{\"idx\":26,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":25,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":15,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":23,\"version\":1},{\"idx\":24,\"version\":1},{\"idx\":21,\"version\":1},{\"idx\":22,\"version\":1},{\"idx\":25,\"version\":1},{\"idx\":26,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in1_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"in3_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_4\",\"version\":1},{\"value\":\"join_4\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let mut sg_1v1_node_13v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_1v1_node_14v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in2) + }; + let sg_1v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_1v1_node_15v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(in3) + }; + let sg_1v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_1v1_node_17v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_17v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_17v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_17v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_21v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_21v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_21v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_1v1_node_21v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_1v1_node_11v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(), + false, + move |context, var_args!(), var_args!()| { + let op_13v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_13v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__source_stream__loc_nopath_2_24_2_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__source_stream__loc_nopath_2_24_2_42(op_13v1) + }; + let op_2v1 = op_13v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_22(op_2v1) + }; + let op_14v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_14v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__source_stream__loc_nopath_3_24_3_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__source_stream__loc_nopath_3_24_3_42(op_14v1) + }; + let op_5v1 = op_14v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_22(op_5v1) + }; + let op_15v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_15v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__source_stream__loc_nopath_4_24_4_42< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_15v1__source_stream__loc_nopath_4_24_4_42(op_15v1) + }; + let op_8v1 = op_15v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_4_19_4_22< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_4_19_4_22(op_8v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = op_2v1.map(|_v: (_, _)| ((_v.1,), (_v.0,))); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_7_31_7_40< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_7_31_7_40(op_19v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_20v1 = op_5v1.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_7_42_7_51< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__map__loc_nopath_7_42_7_51(op_20v1) + }; + let mut sg_1v1_node_17v1_joindata_lhs_borrow = context + .state_ref(sg_1v1_node_17v1_joindata_lhs) + .borrow_mut(); + let mut sg_1v1_node_17v1_joindata_rhs_borrow = context + .state_ref(sg_1v1_node_17v1_joindata_rhs) + .borrow_mut(); + let op_17v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_19v1, + op_20v1, + &mut *sg_1v1_node_17v1_joindata_lhs_borrow, + &mut *sg_1v1_node_17v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__join__loc_nopath_7_12_7_63< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__join__loc_nopath_7_12_7_63(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1 + .map(|kv: ((_,), ((_,), (_,)))| (kv.0.0, kv.1.0.0, kv.1.1.0)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_7_12_7_63< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_7_12_7_63(op_18v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_23v1 = op_18v1.map(|_v: (_, _, _)| ((_v.2,), (_v.1, _v.0))); + let op_23v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_23v1__map__loc_nopath_7_31_7_51< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_23v1__map__loc_nopath_7_31_7_51(op_23v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_24v1 = op_8v1.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_24v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_24v1__map__loc_nopath_7_53_7_62< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_24v1__map__loc_nopath_7_53_7_62(op_24v1) + }; + let mut sg_1v1_node_21v1_joindata_lhs_borrow = context + .state_ref(sg_1v1_node_21v1_joindata_lhs) + .borrow_mut(); + let mut sg_1v1_node_21v1_joindata_rhs_borrow = context + .state_ref(sg_1v1_node_21v1_joindata_rhs) + .borrow_mut(); + let op_21v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_23v1, + op_24v1, + &mut *sg_1v1_node_21v1_joindata_lhs_borrow, + &mut *sg_1v1_node_21v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_21v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_21v1__join__loc_nopath_7_12_7_63< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_21v1__join__loc_nopath_7_12_7_63(op_21v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_22v1 = op_21v1 + .map(|kv: ((_,), ((_, _), (_,)))| ( + kv.0.0, + kv.1.0.0, + kv.1.0.1, + kv.1.1.0, + )); + let op_22v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_22v1__map__loc_nopath_7_12_7_63< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_22v1__map__loc_nopath_7_12_7_63(op_22v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_25v1 = op_22v1 + .map(|row: (_, _, _, _)| ((row.3, row.0, row.2, row.1), ())); + let op_25v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_25v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_25v1__map__loc_nopath_1_0_1_0(op_25v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_26v1 = op_25v1 + .map(|(g, a): ((_, _, _, _), _)| (g.0, g.1, g.2, g.3)); + let op_26v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_26v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_26v1__map__loc_nopath_1_0_1_0(op_26v1) + }; + let op_11v1 = op_26v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_11v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__unique__loc_nopath_5_20_5_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__unique__loc_nopath_5_20_5_23(op_11v1) + }; + let op_16v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__for_each__loc_nopath_5_25_5_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_16v1__for_each__loc_nopath_5_25_5_59(op_16v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_11v1, op_16v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@surface_graph.snap new file mode 100644 index 000000000000..2f0bced1151c --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__triple_relation_join@surface_graph.snap @@ -0,0 +1,40 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +5v1 = unique :: < 'tick > (); +8v1 = unique :: < 'tick > (); +11v1 = unique :: < 'tick > (); +13v1 = source_stream (in1); +14v1 = source_stream (in2); +15v1 = source_stream (in3); +16v1 = for_each (| v | out . send (v) . unwrap ()); +17v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +18v1 = map (| kv : ((_ ,) , ((_ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,)); +19v1 = map (| _v : (_ , _ ,) | ((_v . 1 ,) , (_v . 0 ,))); +20v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +21v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +22v1 = map (| kv : ((_ ,) , ((_ , _ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 0 . 1 , kv . 1 . 1 . 0 ,)); +23v1 = map (| _v : (_ , _ , _ ,) | ((_v . 2 ,) , (_v . 1 , _v . 0 ,))); +24v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +25v1 = map (| row : (_ , _ , _ , _ ,) | ((row . 3 , row . 0 , row . 2 , row . 1 ,) , ())); +26v1 = map (| (g , a) : ((_ , _ , _ , _ ,) , _) | (g . 0 , g . 1 , g . 2 , g . 3 ,)); + +13v1 -> 2v1; +14v1 -> 5v1; +15v1 -> 8v1; +26v1 -> 11v1; +11v1 -> 16v1; +17v1 -> 18v1; +19v1 -> 17v1; +2v1 -> 19v1; +20v1 -> 17v1; +5v1 -> 20v1; +21v1 -> 22v1; +23v1 -> 21v1; +18v1 -> 23v1; +24v1 -> 21v1; +8v1 -> 24v1; +25v1 -> 26v1; +22v1 -> 25v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@datalog_program.snap new file mode 100644 index 000000000000..5db39fd5f303 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@datalog_program.snap @@ -0,0 +1,601 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":2},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (input)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | out . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ((_ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 1 ,) , (_v . 0 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ , _ ,) | ((row . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : ((_ ,) , _) | (g . 0 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":6,\"version\":3},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":null,\"version\":2},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":6,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":1},{\"idx\":9,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":4,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":3},{\"idx\":12,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":10,\"version\":1},{\"idx\":13,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":7,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":12,\"version\":1},{\"idx\":9,\"version\":1},{\"idx\":10,\"version\":1},{\"idx\":13,\"version\":1},{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"input_insert\",\"version\":1},{\"value\":\"input\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"out_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_4v3_send, hoff_4v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(4v3)"); + let (hoff_6v3_send, hoff_6v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(6v3)"); + let mut sg_1v1_node_7v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(input) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_2v1_node_9v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_2v1_node_9v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_2v1_node_9v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_2v1_node_9v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_2v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(hoff_4v3_send, hoff_6v3_send), + false, + move |context, var_args!(), var_args!(hoff_4v3_send, hoff_6v3_send)| { + let hoff_4v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_4v3_send.give(Some(v)); + }); + let hoff_6v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_6v3_send.give(Some(v)); + }); + let op_7v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_7v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_7v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_7v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_7v1__source_stream__loc_nopath_2_26_2_46(op_7v1) + }; + let op_2v1 = op_7v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + hoff_6v3_send, + hoff_4v3_send, + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_2_19_2_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_2_19_2_24(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(hoff_4v3_recv, hoff_6v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_4v3_recv, hoff_6v3_recv), var_args!()| { + let mut hoff_4v3_recv = hoff_4v3_recv.borrow_mut_swap(); + let hoff_4v3_recv = hoff_4v3_recv.drain(..); + let mut hoff_6v3_recv = hoff_6v3_recv.borrow_mut_swap(); + let hoff_6v3_recv = hoff_6v3_recv.drain(..); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_11v1 = hoff_6v3_recv.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__map__loc_nopath_5_22_5_33< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__map__loc_nopath_5_22_5_33(op_11v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_12v1 = hoff_4v3_recv.map(|_v: (_, _)| ((_v.1,), (_v.0,))); + let op_12v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_12v1__map__loc_nopath_5_35_5_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_12v1__map__loc_nopath_5_35_5_46(op_12v1) + }; + let mut sg_2v1_node_9v1_joindata_lhs_borrow = context + .state_ref(sg_2v1_node_9v1_joindata_lhs) + .borrow_mut(); + let mut sg_2v1_node_9v1_joindata_rhs_borrow = context + .state_ref(sg_2v1_node_9v1_joindata_rhs) + .borrow_mut(); + let op_9v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_11v1, + op_12v1, + &mut *sg_2v1_node_9v1_joindata_lhs_borrow, + &mut *sg_2v1_node_9v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_9v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_9v1__join__loc_nopath_5_12_5_47< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_9v1__join__loc_nopath_5_12_5_47(op_9v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_10v1 = op_9v1 + .map(|kv: ((_,), ((_,), (_,)))| (kv.0.0, kv.1.0.0, kv.1.1.0)); + let op_10v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_10v1__map__loc_nopath_5_12_5_47< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_10v1__map__loc_nopath_5_12_5_47(op_10v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_13v1 = op_10v1.map(|row: (_, _, _)| ((row.0,), ())); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__map__loc_nopath_1_0_1_0(op_13v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_14v1 = op_13v1.map(|(g, a): ((_,), _)| (g.0,)); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__map__loc_nopath_1_0_1_0(op_14v1) + }; + let op_5v1 = op_14v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_20_3_23< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_20_3_23(op_5v1) + }; + let op_8v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + out.send(v).unwrap() + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__for_each__loc_nopath_3_25_3_59< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_8v1__for_each__loc_nopath_3_25_3_59(op_8v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_5v1, op_8v1); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@surface_graph.snap new file mode 100644 index 000000000000..82cfea328454 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_fields@surface_graph.snap @@ -0,0 +1,27 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +5v1 = unique :: < 'tick > (); +7v1 = source_stream (input); +8v1 = for_each (| v | out . send (v) . unwrap ()); +9v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +10v1 = map (| kv : ((_ ,) , ((_ ,) , (_ ,))) | (kv . 0 . 0 , kv . 1 . 0 . 0 , kv . 1 . 1 . 0 ,)); +11v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +12v1 = map (| _v : (_ , _ ,) | ((_v . 1 ,) , (_v . 0 ,))); +13v1 = map (| row : (_ , _ , _ ,) | ((row . 0 ,) , ())); +14v1 = map (| (g , a) : ((_ ,) , _) | (g . 0 ,)); + +7v1 -> 2v1; +2v1 -> 3v1; +14v1 -> 5v1; +5v1 -> 8v1; +9v1 -> 10v1; +11v1 -> 9v1; +3v1 -> 11v1; +12v1 -> 9v1; +3v1 -> 12v1; +13v1 -> 14v1; +10v1 -> 13v1; diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@datalog_program.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@datalog_program.snap new file mode 100644 index 000000000000..dd39d2b08607 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@datalog_program.snap @@ -0,0 +1,1434 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: "prettyplease :: unparse(& wrapped)" +--- +fn main() { + { + #[allow(unused_qualifications)] + { + use hydroflow::{var_expr, var_args}; + let mut df = hydroflow::scheduled::graph::Hydroflow::new(); + df.__assign_meta_graph( + "{\"nodes\":[{\"value\":null,\"version\":0},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Operator\":\"tee ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"unique :: < 'tick > ()\"},\"version\":1},{\"value\":{\"Handoff\":{}},\"version\":3},{\"value\":{\"Operator\":\"source_stream (ints1)\"},\"version\":1},{\"value\":{\"Operator\":\"source_stream (ints2)\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"for_each (| v | result2 . send (v) . unwrap ())\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ((_ ,) , ())) | (kv . 0 . 0 , kv . 1 . 0 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | ((_v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | (() , (() ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev + 1) } else { Some (1) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : (() , _) | (a . 0 . unwrap () ,))\"},\"version\":1},{\"value\":{\"Operator\":\"join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > ()\"},\"version\":1},{\"value\":{\"Operator\":\"map (| kv : ((_ ,) , ((_ ,) , ())) | (kv . 0 . 0 , kv . 1 . 0 . 0 ,))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| _v : (_ ,) | ((_v . 0 ,) , ()))\"},\"version\":1},{\"value\":{\"Operator\":\"map (| row : (_ , _ ,) | (() , ((row . 0) ,)))\"},\"version\":1},{\"value\":{\"Operator\":\"fold_keyed :: < 'tick , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; })\"},\"version\":1},{\"value\":{\"Operator\":\"map (| (g , a) : (() , _) | (a . 0 . unwrap () . 1 ,))\"},\"version\":1}],\"graph\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":2,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":5,\"version\":1},{\"idx\":6,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":23,\"version\":1},{\"idx\":8,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":9,\"version\":3},{\"idx\":20,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":30,\"version\":1},{\"idx\":11,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":12,\"version\":3},{\"idx\":19,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":1,\"version\":3},{\"idx\":29,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":4,\"version\":3},{\"idx\":27,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":8,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":11,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":12,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":20,\"version\":1},{\"idx\":17,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":6,\"version\":1},{\"idx\":9,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":7,\"version\":3},{\"idx\":26,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":23,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":21,\"version\":1},{\"idx\":10,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":18,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":24,\"version\":1},{\"idx\":25,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":26,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":3,\"version\":1},{\"idx\":7,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":27,\"version\":1},{\"idx\":24,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":6,\"version\":1},{\"idx\":4,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":10,\"version\":3},{\"idx\":22,\"version\":1}],\"version\":3},{\"value\":[{\"idx\":29,\"version\":1},{\"idx\":30,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":28,\"version\":1},{\"idx\":1,\"version\":3}],\"version\":3},{\"value\":[{\"idx\":25,\"version\":1},{\"idx\":28,\"version\":1}],\"version\":1}],\"ports\":[{\"value\":null,\"version\":0},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[{\"Int\":\"0\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",{\"Int\":\"0\"}],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",{\"Int\":\"1\"}],\"version\":1},{\"value\":[{\"Int\":\"1\"},\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1},{\"value\":[\"Elided\",\"Elided\"],\"version\":3},{\"value\":[\"Elided\",\"Elided\"],\"version\":1}],\"node_loops\":[{\"value\":null,\"version\":0}],\"loop_nodes\":[{\"value\":null,\"version\":0}],\"loop_parent\":[{\"value\":null,\"version\":0}],\"loop_children\":[{\"value\":null,\"version\":0}],\"node_subgraph\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":null,\"version\":0},{\"value\":{\"idx\":1,\"version\":1},\"version\":1},{\"value\":{\"idx\":2,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":5,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":3,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":6,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1},{\"value\":{\"idx\":4,\"version\":1},\"version\":1}],\"subgraph_nodes\":[{\"value\":null,\"version\":0},{\"value\":[{\"idx\":13,\"version\":1},{\"idx\":2,\"version\":1},{\"idx\":3,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":14,\"version\":1},{\"idx\":5,\"version\":1},{\"idx\":6,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":22,\"version\":1},{\"idx\":23,\"version\":1},{\"idx\":8,\"version\":1},{\"idx\":15,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":29,\"version\":1},{\"idx\":30,\"version\":1},{\"idx\":11,\"version\":1},{\"idx\":16,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":19,\"version\":1},{\"idx\":20,\"version\":1},{\"idx\":17,\"version\":1},{\"idx\":18,\"version\":1},{\"idx\":21,\"version\":1}],\"version\":1},{\"value\":[{\"idx\":26,\"version\":1},{\"idx\":27,\"version\":1},{\"idx\":24,\"version\":1},{\"idx\":25,\"version\":1},{\"idx\":28,\"version\":1}],\"version\":1}],\"subgraph_stratum\":[{\"value\":null,\"version\":0},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1},{\"value\":1,\"version\":1},{\"value\":1,\"version\":1},{\"value\":0,\"version\":1},{\"value\":0,\"version\":1}],\"node_singleton_references\":[{\"value\":null,\"version\":0},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1},{\"value\":[],\"version\":1}],\"node_varnames\":[{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"ints1_insert\",\"version\":1},{\"value\":\"ints1\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"ints2_insert\",\"version\":1},{\"value\":\"ints2\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":\"result_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"result2_insert\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_2\",\"version\":1},{\"value\":\"join_2\",\"version\":1},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":null,\"version\":0},{\"value\":\"join_5\",\"version\":1},{\"value\":\"join_5\",\"version\":1}],\"subgraph_laziness\":[{\"value\":null,\"version\":0}]}", + ); + df.__assign_diagnostics("[]"); + let (hoff_1v3_send, hoff_1v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(1v3)"); + let (hoff_4v3_send, hoff_4v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(4v3)"); + let (hoff_7v3_send, hoff_7v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(7v3)"); + let (hoff_9v3_send, hoff_9v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(9v3)"); + let (hoff_10v3_send, hoff_10v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(10v3)"); + let (hoff_12v3_send, hoff_12v3_recv) = df + .make_edge::< + _, + hydroflow::scheduled::handoff::VecHandoff<_>, + >("handoff GraphNodeId(12v3)"); + let mut sg_1v1_node_13v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints1) + }; + let sg_1v1_node_2v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let mut sg_2v1_node_14v1_stream = { + #[inline(always)] + fn check_stream< + Stream: hydroflow::futures::stream::Stream + + ::std::marker::Unpin, + Item, + >( + stream: Stream, + ) -> impl hydroflow::futures::stream::Stream< + Item = Item, + > + ::std::marker::Unpin { + stream + } + check_stream(ints2) + }; + let sg_2v1_node_5v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_3v1_node_22v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(), (Option<_>,)>::default(), + ), + ); + let sg_3v1_node_8v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_4v1_node_29v1_groupbydata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::rustc_hash::FxHashMap::<(), (Option<_>,)>::default(), + ), + ); + let sg_4v1_node_11v1_uniquedata = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::util::monotonic_map::MonotonicMap::< + _, + hydroflow::rustc_hash::FxHashSet<_>, + >::default(), + ), + ); + let sg_5v1_node_17v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_5v1_node_17v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_5v1_node_17v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_5v1_node_17v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_6v1_node_24v1_joindata_lhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_6v1_node_24v1_joindata_lhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + let sg_6v1_node_24v1_joindata_rhs = df + .add_state( + ::std::cell::RefCell::new( + hydroflow::compiled::pull::HalfMultisetJoinState::default(), + ), + ); + df.set_state_tick_hook( + sg_6v1_node_24v1_joindata_rhs, + |rcell| hydroflow::util::clear::Clear::clear(rcell.get_mut()), + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(1v1)", + 0, + var_expr!(), + var_expr!(hoff_7v3_send, hoff_12v3_send), + false, + move |context, var_args!(), var_args!(hoff_7v3_send, hoff_12v3_send)| { + let hoff_7v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_7v3_send.give(Some(v)); + }); + let hoff_12v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_12v3_send.give(Some(v)); + }); + let op_13v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_1v1_node_13v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_13v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_13v1__source_stream__loc_nopath_2_26_2_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_13v1__source_stream__loc_nopath_2_26_2_46(op_13v1) + }; + let op_2v1 = op_13v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_1v1_node_2v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_2v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_2v1__unique__loc_nopath_2_19_2_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_2v1__unique__loc_nopath_2_19_2_24(op_2v1) + }; + let op_3v1 = hydroflow::pusherator::tee::Tee::new( + hoff_12v3_send, + hoff_7v3_send, + ); + let op_3v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_3v1__tee__loc_nopath_2_19_2_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_3v1__tee__loc_nopath_2_19_2_24(op_3v1) + }; + #[inline(always)] + fn pivot_run_sg_1v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_1v1(op_2v1, op_3v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(2v1)", + 0, + var_expr!(), + var_expr!(hoff_4v3_send, hoff_9v3_send), + false, + move |context, var_args!(), var_args!(hoff_4v3_send, hoff_9v3_send)| { + let hoff_4v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_4v3_send.give(Some(v)); + }); + let hoff_9v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_9v3_send.give(Some(v)); + }); + let op_14v1 = std::iter::from_fn(|| { + match hydroflow::futures::stream::Stream::poll_next( + ::std::pin::Pin::new(&mut sg_2v1_node_14v1_stream), + &mut std::task::Context::from_waker(&context.waker()), + ) { + std::task::Poll::Ready(maybe) => maybe, + std::task::Poll::Pending => None, + } + }); + let op_14v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_14v1__source_stream__loc_nopath_3_26_3_46< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_14v1__source_stream__loc_nopath_3_26_3_46(op_14v1) + }; + let op_5v1 = op_14v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_2v1_node_5v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_5v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_5v1__unique__loc_nopath_3_19_3_24< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_5v1__unique__loc_nopath_3_19_3_24(op_5v1) + }; + let op_6v1 = hydroflow::pusherator::tee::Tee::new( + hoff_9v3_send, + hoff_4v3_send, + ); + let op_6v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_6v1__tee__loc_nopath_3_19_3_24< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_6v1__tee__loc_nopath_3_19_3_24(op_6v1) + }; + #[inline(always)] + fn pivot_run_sg_2v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_2v1(op_5v1, op_6v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(3v1)", + 1, + var_expr!(hoff_10v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_10v3_recv), var_args!()| { + let mut hoff_10v3_recv = hoff_10v3_recv.borrow_mut_swap(); + let hoff_10v3_recv = hoff_10v3_recv.drain(..); + let mut sg_3v1_node_22v1_hashtable = context + .state_ref(sg_3v1_node_22v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_10v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_3v1_node_22v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some(prev + 1) + } else { + Some(1) + }; + }, + ); + } + } + let op_22v1 = sg_3v1_node_22v1_hashtable.drain(); + let op_22v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_22v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_22v1__fold_keyed__loc_nopath_1_0_1_0(op_22v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_23v1 = op_22v1.map(|(g, a): ((), _)| (a.0.unwrap(),)); + let op_23v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_23v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_23v1__map__loc_nopath_1_0_1_0(op_23v1) + }; + let op_8v1 = op_23v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_3v1_node_8v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_8v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_8v1__unique__loc_nopath_5_20_5_26< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_8v1__unique__loc_nopath_5_20_5_26(op_8v1) + }; + let op_15v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result.send(v).unwrap() + }); + let op_15v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_15v1__for_each__loc_nopath_5_28_5_65< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_15v1__for_each__loc_nopath_5_28_5_65(op_15v1) + }; + #[inline(always)] + fn pivot_run_sg_3v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_3v1(op_8v1, op_15v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(4v1)", + 1, + var_expr!(hoff_1v3_recv), + var_expr!(), + false, + move |context, var_args!(hoff_1v3_recv), var_args!()| { + let mut hoff_1v3_recv = hoff_1v3_recv.borrow_mut_swap(); + let hoff_1v3_recv = hoff_1v3_recv.drain(..); + let mut sg_4v1_node_29v1_hashtable = context + .state_ref(sg_4v1_node_29v1_groupbydata) + .borrow_mut(); + { + #[inline(always)] + fn check_input( + iter: Iter, + ) -> impl ::std::iter::Iterator + where + Iter: std::iter::Iterator, + A: ::std::clone::Clone, + B: ::std::clone::Clone, + { + iter + } + /// A: accumulator type + /// T: iterator item type + /// O: output type + #[inline(always)] + fn call_comb_type( + a: &mut A, + t: T, + f: impl Fn(&mut A, T) -> O, + ) -> O { + (f)(a, t) + } + for kv in check_input(hoff_1v3_recv) { + #[allow(unknown_lints, clippy::unwrap_or_default)] + let entry = sg_4v1_node_29v1_hashtable + .entry(kv.0) + .or_insert_with(|| (None,)); + #[allow(clippy::redundant_closure_call)] + call_comb_type( + entry, + kv.1, + |old: &mut (Option<_>,), val: (_,)| { + old.0 = if let Some(prev) = old.0.take() { + Some({ + let prev: (hydroflow::rustc_hash::FxHashSet<_>, _) = prev; + let mut set: hydroflow::rustc_hash::FxHashSet<_> = prev.0; + if set.insert(val.0) { + (set, prev.1 + 1) + } else { + (set, prev.1) + } + }) + } else { + Some({ + let mut set = hydroflow::rustc_hash::FxHashSet::< + _, + >::default(); + set.insert(val.0); + (set, 1) + }) + }; + }, + ); + } + } + let op_29v1 = sg_4v1_node_29v1_hashtable.drain(); + let op_29v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_29v1__fold_keyed__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_29v1__fold_keyed__loc_nopath_1_0_1_0(op_29v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_30v1 = op_29v1.map(|(g, a): ((), _)| (a.0.unwrap().1,)); + let op_30v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_30v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_30v1__map__loc_nopath_1_0_1_0(op_30v1) + }; + let op_11v1 = op_30v1 + .filter(|item| { + let mut borrow = context + .state_ref(sg_4v1_node_11v1_uniquedata) + .borrow_mut(); + let set = borrow + .get_mut_clear(( + context.current_tick(), + context.current_stratum(), + )); + if !set.contains(item) { + set.insert(::std::clone::Clone::clone(item)); + true + } else { + false + } + }); + let op_11v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_11v1__unique__loc_nopath_6_20_6_27< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_11v1__unique__loc_nopath_6_20_6_27(op_11v1) + }; + let op_16v1 = hydroflow::pusherator::for_each::ForEach::new(|v| { + result2.send(v).unwrap() + }); + let op_16v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_16v1__for_each__loc_nopath_6_29_6_67< + Item, + Input: hydroflow::pusherator::Pusherator, + >( + input: Input, + ) -> impl hydroflow::pusherator::Pusherator { + #[repr(transparent)] + struct Push< + Item, + Input: hydroflow::pusherator::Pusherator, + > { + inner: Input, + } + impl< + Item, + Input: hydroflow::pusherator::Pusherator, + > hydroflow::pusherator::Pusherator for Push { + type Item = Item; + #[inline(always)] + fn give(&mut self, item: Self::Item) { + self.inner.give(item) + } + } + Push { inner: input } + } + op_16v1__for_each__loc_nopath_6_29_6_67(op_16v1) + }; + #[inline(always)] + fn pivot_run_sg_4v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_4v1(op_11v1, op_16v1); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(5v1)", + 0, + var_expr!(hoff_9v3_recv, hoff_12v3_recv), + var_expr!(hoff_10v3_send), + false, + move | + context, + var_args!(hoff_9v3_recv, hoff_12v3_recv), + var_args!(hoff_10v3_send)| + { + let mut hoff_9v3_recv = hoff_9v3_recv.borrow_mut_swap(); + let hoff_9v3_recv = hoff_9v3_recv.drain(..); + let mut hoff_12v3_recv = hoff_12v3_recv.borrow_mut_swap(); + let hoff_12v3_recv = hoff_12v3_recv.drain(..); + let hoff_10v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_10v3_send.give(Some(v)); + }); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_19v1 = hoff_12v3_recv.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_19v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_19v1__map__loc_nopath_8_32_8_43< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_19v1__map__loc_nopath_8_32_8_43(op_19v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_20v1 = hoff_9v3_recv.map(|_v: (_,)| ((_v.0,), ())); + let op_20v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_20v1__map__loc_nopath_8_45_8_53< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_20v1__map__loc_nopath_8_45_8_53(op_20v1) + }; + let mut sg_5v1_node_17v1_joindata_lhs_borrow = context + .state_ref(sg_5v1_node_17v1_joindata_lhs) + .borrow_mut(); + let mut sg_5v1_node_17v1_joindata_rhs_borrow = context + .state_ref(sg_5v1_node_17v1_joindata_rhs) + .borrow_mut(); + let op_17v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_19v1, + op_20v1, + &mut *sg_5v1_node_17v1_joindata_lhs_borrow, + &mut *sg_5v1_node_17v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_17v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_17v1__join__loc_nopath_8_12_8_53< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_17v1__join__loc_nopath_8_12_8_53(op_17v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_18v1 = op_17v1 + .map(|kv: ((_,), ((_,), ()))| (kv.0.0, kv.1.0.0)); + let op_18v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_18v1__map__loc_nopath_8_12_8_53< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_18v1__map__loc_nopath_8_12_8_53(op_18v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_21v1 = op_18v1.map(|row: (_, _)| ((), ((),))); + let op_21v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_21v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_21v1__map__loc_nopath_1_0_1_0(op_21v1) + }; + #[inline(always)] + fn pivot_run_sg_5v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_5v1(op_21v1, hoff_10v3_send); + }, + ); + df.add_subgraph_stratified( + "Subgraph GraphSubgraphId(6v1)", + 0, + var_expr!(hoff_4v3_recv, hoff_7v3_recv), + var_expr!(hoff_1v3_send), + false, + move | + context, + var_args!(hoff_4v3_recv, hoff_7v3_recv), + var_args!(hoff_1v3_send)| + { + let mut hoff_4v3_recv = hoff_4v3_recv.borrow_mut_swap(); + let hoff_4v3_recv = hoff_4v3_recv.drain(..); + let mut hoff_7v3_recv = hoff_7v3_recv.borrow_mut_swap(); + let hoff_7v3_recv = hoff_7v3_recv.drain(..); + let hoff_1v3_send = hydroflow::pusherator::for_each::ForEach::new(| + v| + { + hoff_1v3_send.give(Some(v)); + }); + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_26v1 = hoff_7v3_recv.map(|_v: (_, _)| ((_v.0,), (_v.1,))); + let op_26v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_26v1__map__loc_nopath_9_33_9_44< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_26v1__map__loc_nopath_9_33_9_44(op_26v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_27v1 = hoff_4v3_recv.map(|_v: (_,)| ((_v.0,), ())); + let op_27v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_27v1__map__loc_nopath_9_46_9_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_27v1__map__loc_nopath_9_46_9_54(op_27v1) + }; + let mut sg_6v1_node_24v1_joindata_lhs_borrow = context + .state_ref(sg_6v1_node_24v1_joindata_lhs) + .borrow_mut(); + let mut sg_6v1_node_24v1_joindata_rhs_borrow = context + .state_ref(sg_6v1_node_24v1_joindata_rhs) + .borrow_mut(); + let op_24v1 = { + #[inline(always)] + fn check_inputs<'a, K, I1, V1, I2, V2>( + lhs: I1, + rhs: I2, + lhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V1, + V2, + >, + rhs_state: &'a mut hydroflow::compiled::pull::HalfMultisetJoinState< + K, + V2, + V1, + >, + is_new_tick: bool, + ) -> impl 'a + Iterator + where + K: Eq + std::hash::Hash + Clone, + V1: Clone, + V2: Clone, + I1: 'a + Iterator, + I2: 'a + Iterator, + { + hydroflow::compiled::pull::symmetric_hash_join_into_iter( + lhs, + rhs, + lhs_state, + rhs_state, + is_new_tick, + ) + } + check_inputs( + op_26v1, + op_27v1, + &mut *sg_6v1_node_24v1_joindata_lhs_borrow, + &mut *sg_6v1_node_24v1_joindata_rhs_borrow, + context.is_first_run_this_tick(), + ) + }; + let op_24v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_24v1__join__loc_nopath_9_12_9_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_24v1__join__loc_nopath_9_12_9_54(op_24v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_25v1 = op_24v1 + .map(|kv: ((_,), ((_,), ()))| (kv.0.0, kv.1.0.0)); + let op_25v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_25v1__map__loc_nopath_9_12_9_54< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_25v1__map__loc_nopath_9_12_9_54(op_25v1) + }; + #[allow( + clippy::map_clone, + reason = "hydroflow has no explicit `cloned`/`copied` operator" + )] + let op_28v1 = op_25v1.map(|row: (_, _)| ((), ((row.0),))); + let op_28v1 = { + #[allow(non_snake_case)] + #[inline(always)] + pub fn op_28v1__map__loc_nopath_1_0_1_0< + Item, + Input: ::std::iter::Iterator, + >(input: Input) -> impl ::std::iter::Iterator { + #[repr(transparent)] + struct Pull< + Item, + Input: ::std::iter::Iterator, + > { + inner: Input, + } + impl< + Item, + Input: ::std::iter::Iterator, + > Iterator for Pull { + type Item = Item; + #[inline(always)] + fn next(&mut self) -> Option { + self.inner.next() + } + #[inline(always)] + fn size_hint(&self) -> (usize, Option) { + self.inner.size_hint() + } + } + Pull { inner: input } + } + op_28v1__map__loc_nopath_1_0_1_0(op_28v1) + }; + #[inline(always)] + fn pivot_run_sg_6v1< + Pull: ::std::iter::Iterator, + Push: hydroflow::pusherator::Pusherator, + Item, + >(pull: Pull, push: Push) { + hydroflow::pusherator::pivot::Pivot::new(pull, push).run(); + } + pivot_run_sg_6v1(op_28v1, hoff_1v3_send); + }, + ); + df + } + } +} diff --git a/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@surface_graph.snap b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@surface_graph.snap new file mode 100644 index 000000000000..6d3353ab3600 --- /dev/null +++ b/dfir_datalog_core/src/snapshots/dfir_datalog_core__tests__wildcard_join_count@surface_graph.snap @@ -0,0 +1,53 @@ +--- +source: dfir_datalog_core/src/lib.rs +expression: flat_graph_ref.surface_syntax_string() +--- +2v1 = unique :: < 'tick > (); +3v1 = tee (); +5v1 = unique :: < 'tick > (); +6v1 = tee (); +8v1 = unique :: < 'tick > (); +11v1 = unique :: < 'tick > (); +13v1 = source_stream (ints1); +14v1 = source_stream (ints2); +15v1 = for_each (| v | result . send (v) . unwrap ()); +16v1 = for_each (| v | result2 . send (v) . unwrap ()); +17v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +18v1 = map (| kv : ((_ ,) , ((_ ,) , ())) | (kv . 0 . 0 , kv . 1 . 0 . 0 ,)); +19v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +20v1 = map (| _v : (_ ,) | ((_v . 0 ,) , ())); +21v1 = map (| row : (_ , _ ,) | (() , (() ,))); +22v1 = fold_keyed :: < 'tick , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some (prev + 1) } else { Some (1) } ; }); +23v1 = map (| (g , a) : (() , _) | (a . 0 . unwrap () ,)); +24v1 = join :: < 'tick , 'tick , hydroflow :: compiled :: pull :: HalfMultisetJoinState > (); +25v1 = map (| kv : ((_ ,) , ((_ ,) , ())) | (kv . 0 . 0 , kv . 1 . 0 . 0 ,)); +26v1 = map (| _v : (_ , _ ,) | ((_v . 0 ,) , (_v . 1 ,))); +27v1 = map (| _v : (_ ,) | ((_v . 0 ,) , ())); +28v1 = map (| row : (_ , _ ,) | (() , ((row . 0) ,))); +29v1 = fold_keyed :: < 'tick , () , (Option < _ > ,) > (| | (None ,) , | old : & mut (Option < _ > ,) , val : (_ ,) | { old . 0 = if let Some (prev) = old . 0 . take () { Some ({ let prev : (hydroflow :: rustc_hash :: FxHashSet < _ > , _) = prev ; let mut set : hydroflow :: rustc_hash :: FxHashSet < _ > = prev . 0 ; if set . insert (val . 0) { (set , prev . 1 + 1) } else { (set , prev . 1) } }) } else { Some ({ let mut set = hydroflow :: rustc_hash :: FxHashSet :: < _ > :: default () ; set . insert (val . 0) ; (set , 1) }) } ; }); +30v1 = map (| (g , a) : (() , _) | (a . 0 . unwrap () . 1 ,)); + +13v1 -> 2v1; +2v1 -> 3v1; +14v1 -> 5v1; +5v1 -> 6v1; +23v1 -> 8v1; +30v1 -> 11v1; +8v1 -> 15v1; +11v1 -> 16v1; +17v1 -> 18v1; +19v1 -> 17v1; +3v1 -> 19v1; +20v1 -> 17v1; +6v1 -> 20v1; +22v1 -> 23v1; +21v1 -> 22v1; +18v1 -> 21v1; +24v1 -> 25v1; +26v1 -> 24v1; +3v1 -> 26v1; +27v1 -> 24v1; +6v1 -> 27v1; +29v1 -> 30v1; +28v1 -> 29v1; +25v1 -> 28v1; diff --git a/hydro_deploy/hydro_cli_examples/Cargo.toml b/hydro_deploy/hydro_cli_examples/Cargo.toml index 09dc6d182e2c..92e24329d2ca 100644 --- a/hydro_deploy/hydro_cli_examples/Cargo.toml +++ b/hydro_deploy/hydro_cli_examples/Cargo.toml @@ -39,7 +39,7 @@ name = "ws_chat_server" [dev-dependencies] hydroflow = { path = "../../hydroflow", features = [ "deploy_integration" ] } -hydroflow_datalog = { path = "../../hydroflow_datalog" } +dfir_datalog = { path = "../../dfir_datalog" } tokio = { version = "1.29.0", features = [ "full" ] } serde = { version = "1.0.197", features = ["rc"] } diff --git a/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_coordinator/main.rs b/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_coordinator/main.rs index 57eff93ca75f..5dcec88150ce 100644 --- a/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_coordinator/main.rs +++ b/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_coordinator/main.rs @@ -1,6 +1,6 @@ +use dfir_datalog::datalog; use hydroflow::util::deploy::{ConnectedDemux, ConnectedDirect, ConnectedSink, ConnectedSource}; use hydroflow::util::{deserialize_from_bytes, serialize_to_bytes}; -use hydroflow_datalog::datalog; #[hydroflow::main] async fn main() { diff --git a/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_participant/main.rs b/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_participant/main.rs index 97a806db7c9d..c662b881bf21 100644 --- a/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_participant/main.rs +++ b/hydro_deploy/hydro_cli_examples/examples/dedalus_2pc_participant/main.rs @@ -1,6 +1,6 @@ +use dfir_datalog::datalog; use hydroflow::util::deploy::{ConnectedDemux, ConnectedDirect, ConnectedSink, ConnectedSource}; use hydroflow::util::{deserialize_from_bytes, serialize_to_bytes}; -use hydroflow_datalog::datalog; #[hydroflow::main] async fn main() { diff --git a/hydro_deploy/hydro_cli_examples/examples/dedalus_receiver/main.rs b/hydro_deploy/hydro_cli_examples/examples/dedalus_receiver/main.rs index ae37b42e8b71..15b2e82ffb98 100644 --- a/hydro_deploy/hydro_cli_examples/examples/dedalus_receiver/main.rs +++ b/hydro_deploy/hydro_cli_examples/examples/dedalus_receiver/main.rs @@ -1,6 +1,6 @@ +use dfir_datalog::datalog; use hydroflow::util::deploy::{ConnectedDirect, ConnectedSource}; use hydroflow::util::deserialize_from_bytes; -use hydroflow_datalog::datalog; #[hydroflow::main] async fn main() { diff --git a/hydro_deploy/hydro_cli_examples/examples/dedalus_sender/main.rs b/hydro_deploy/hydro_cli_examples/examples/dedalus_sender/main.rs index b9e2c9d43f26..ab6db5232500 100644 --- a/hydro_deploy/hydro_cli_examples/examples/dedalus_sender/main.rs +++ b/hydro_deploy/hydro_cli_examples/examples/dedalus_sender/main.rs @@ -1,7 +1,7 @@ +use dfir_datalog::datalog; use hydroflow::tokio_stream::wrappers::IntervalStream; use hydroflow::util::deploy::{ConnectedDemux, ConnectedDirect, ConnectedSink}; use hydroflow::util::serialize_to_bytes; -use hydroflow_datalog::datalog; #[hydroflow::main] async fn main() { diff --git a/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_leader/main.rs b/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_leader/main.rs index 7e21656bba5e..5bbdc2bc4147 100644 --- a/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_leader/main.rs +++ b/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_leader/main.rs @@ -1,6 +1,6 @@ +use dfir_datalog::datalog; use hydroflow::util::deploy::{ConnectedDemux, ConnectedDirect, ConnectedSink, ConnectedSource}; use hydroflow::util::{deserialize_from_bytes, serialize_to_bytes}; -use hydroflow_datalog::datalog; #[hydroflow::main] async fn main() { diff --git a/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_participant/main.rs b/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_participant/main.rs index eaa142a39945..51c614d98783 100644 --- a/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_participant/main.rs +++ b/hydro_deploy/hydro_cli_examples/examples/dedalus_vote_participant/main.rs @@ -1,6 +1,6 @@ +use dfir_datalog::datalog; use hydroflow::util::deploy::{ConnectedDemux, ConnectedDirect, ConnectedSink, ConnectedSource}; use hydroflow::util::{deserialize_from_bytes, serialize_to_bytes}; -use hydroflow_datalog::datalog; #[hydroflow::main] async fn main() { diff --git a/hydroflow/Cargo.toml b/hydroflow/Cargo.toml index 941b0742566f..056b7b2491af 100644 --- a/hydroflow/Cargo.toml +++ b/hydroflow/Cargo.toml @@ -14,9 +14,9 @@ workspace = true default = [ "macros", "debugging", "meta" ] meta = [ "dep:hydroflow_lang" ] -macros = [ "dfir_macro", "hydroflow_datalog" ] +macros = [ "dfir_macro", "dfir_datalog" ] dfir_macro = [ "dep:dfir_macro" ] -hydroflow_datalog = [ "dep:hydroflow_datalog" ] +dfir_datalog = [ "dep:dfir_datalog" ] deploy_integration = [ "dep:hydroflow_deploy_integration" ] python = [ "dep:pyo3" ] debugging = [ "hydroflow_lang/debugging" ] @@ -35,7 +35,7 @@ byteorder = "1.3.2" bytes = "1.1.0" futures = "0.3.0" hydroflow_deploy_integration = { optional = true, path = "../hydro_deploy/hydroflow_deploy_integration", version = "^0.10.0" } -hydroflow_datalog = { optional = true, path = "../hydroflow_datalog", version = "^0.10.0" } +dfir_datalog = { optional = true, path = "../dfir_datalog", version = "^0.10.0" } hydroflow_lang = { path = "../hydroflow_lang", version = "^0.10.0", optional = true } dfir_macro = { optional = true, path = "../dfir_macro", version = "^0.10.0" } itertools = "0.10.0" diff --git a/hydroflow/src/lib.rs b/hydroflow/src/lib.rs index 0f403208e6a7..f7a7b6dd767c 100644 --- a/hydroflow/src/lib.rs +++ b/hydroflow/src/lib.rs @@ -32,13 +32,13 @@ pub use { /// `#[macro_use]` automagically brings the declarative macro export to the crate-level. mod declarative_macro; +#[cfg(feature = "dfir_datalog")] +pub use dfir_datalog::*; #[cfg(feature = "dfir_macro")] pub use dfir_macro::{ dfir_main as main, dfir_parser, dfir_syntax, dfir_syntax_noemit, dfir_test as test, monotonic_fn, morphism, DemuxEnum, }; -#[cfg(feature = "hydroflow_datalog")] -pub use hydroflow_datalog::*; // TODO(mingwei): Use the [nightly "never" type `!`](https://doc.rust-lang.org/std/primitive.never.html) /// Stand-in for the [nightly "never" type `!`](https://doc.rust-lang.org/std/primitive.never.html) diff --git a/topolotree/Cargo.toml b/topolotree/Cargo.toml index 030887fa71ed..25f383022b00 100644 --- a/topolotree/Cargo.toml +++ b/topolotree/Cargo.toml @@ -25,7 +25,7 @@ path = "src/latency_measure.rs" [dependencies] hydroflow = { path = "../hydroflow", features = [ "deploy_integration" ] } -hydroflow_datalog = { path = "../hydroflow_datalog" } +dfir_datalog = { path = "../dfir_datalog" } tokio = { version = "1.29.0", features = [ "full" ] } serde = { version = "1.0.197", features = ["rc"] }