Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: generalized hash trie indexes for relational tuples #1503

Merged
merged 132 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 125 commits
Commits
Show all changes
132 commits
Select commit Hold shift + click to select a range
5dc3f61
initial GHT implementation. depends on #1245 and #1242
jhellerstein May 30, 2024
57aab24
mostly working, some trouble with `contains` on references
jhellerstein May 30, 2024
e639095
passing tests
jhellerstein May 31, 2024
1afb0b7
syncing to github
jhellerstein May 31, 2024
2de3dda
working to_hash_trie and get()
jhellerstein Jun 3, 2024
b0f8391
move GHT to lattices, complete get() and iter()
jhellerstein Jun 3, 2024
d631466
WIP: Len trait working, Merge trait in progress
jhellerstein Jun 4, 2024
8e2c3c8
Merge now working
jhellerstein Jun 4, 2024
b3398a9
WIP: PartialOrd and Merge compiling, need to be tested
jhellerstein Jun 5, 2024
5e3ddc3
WIP: added LatticeOrd, Eq, IsBot, IsTop traits
jhellerstein Jun 5, 2024
a813cc9
WIP: lattice tests passing
jhellerstein Jun 5, 2024
a074bc6
simplify ergonomics, test in hydroflow
jhellerstein Jun 6, 2024
b0fea7a
WIP: try to get bimorphisms and GHT to coexist
jhellerstein Jun 7, 2024
7d8ef49
create a metadata trait for the whole GHT, old trait is now GHTNode
jhellerstein Jun 13, 2024
1d1c3b5
Ght wrapper now supports most lattice traits.
jhellerstein Jun 13, 2024
4948f50
WIP: fix keyed bimorphism
jhellerstein Jun 14, 2024
7fb1140
WIP: bimorphisms now working on GeneralizedHashTrieNode
jhellerstein Jun 14, 2024
1aeb8c0
checkpoint -- largely working
jhellerstein Jun 17, 2024
fa0f2dd
refactor lattices into multiple files and fix tests
jhellerstein Jun 17, 2024
b37fcfe
add ght tests
jhellerstein Jun 17, 2024
78caf0c
initial GHT implementation. depends on #1245 and #1242
jhellerstein May 30, 2024
b506346
move GHT to lattices, complete get() and iter()
jhellerstein Jun 3, 2024
6227aa0
complete rebase
jhellerstein Jun 17, 2024
36fd1b1
make clippy happier
jhellerstein Jun 17, 2024
1af4e00
add macro tuple! to convert variadic into tuple
jhellerstein Jun 22, 2024
b673e19
add tuple! macro to convert variadic to tuple
jhellerstein Jun 22, 2024
f44c87e
clean up tests removing println and asserting correctness
jhellerstein Jun 24, 2024
3eadff3
generic join working for triangle query
jhellerstein Jun 24, 2024
539173f
test for generic join working well
jhellerstein Jun 25, 2024
686510b
freejoin functioning
jhellerstein Jun 25, 2024
950ba2f
remove unused var_len macro from variadics
jhellerstein Jun 27, 2024
5ca2f63
clean up warnings
jhellerstein Jun 27, 2024
dc975d7
fix(variadics): fix `HomogenousVariadic` `get` and `get_mut` only ret…
MingweiSamuel Jun 28, 2024
8c796a1
chore: Update RunLLM Configuration (#1328)
agiron123 Jul 1, 2024
5dbf41c
fix(lattices): change fuzz test bounds to require `PartialEq` instead…
MingweiSamuel Jul 1, 2024
7a1126c
feat(variadics): add traits for dealing with variadics of references …
MingweiSamuel Jul 2, 2024
482d57e
refactor(hydroflow_lang)!: require lifetime on `perist*()` operators …
MingweiSamuel Jul 2, 2024
5e87bdf
refactor(hydroflow_plus_test): reorganize examples, one per file, add…
MingweiSamuel Jul 10, 2024
802ed77
refactor(hydro_deploy): build cache cleanup (#1334)
MingweiSamuel Jul 12, 2024
cf5d85e
style(hydro_deploy): rename `SSH` -> `Ssh` (#1340)
MingweiSamuel Jul 14, 2024
ff42252
refactor(hydro_deploy): remove unneeded `Arc<RwLock<` wrapping of `la…
MingweiSamuel Jul 15, 2024
e713c31
style(hydroflow_lang): fix unnecessary `&` for clippy
MingweiSamuel Jul 15, 2024
b16f645
fix: add papers to website (#1342)
jhellerstein Jul 15, 2024
3b92f17
docs: update cargo-generate commands, say to run `rustup update` to e…
MingweiSamuel Jul 15, 2024
7c3ac72
working to_hash_trie and get()
jhellerstein Jun 3, 2024
ef31bd9
WIP: try to get bimorphisms and GHT to coexist
jhellerstein Jun 7, 2024
67b62e6
checkpoint -- largely working
jhellerstein Jun 17, 2024
16c6961
checkpoint after NH
jhellerstein Jul 15, 2024
cbf8e1e
rebasing
jhellerstein Jul 16, 2024
2442640
WIP on fixing rebase
jhellerstein Jul 16, 2024
19c99c1
now compiling after rebase
jhellerstein Jul 16, 2024
ec66a8a
passing tests
jhellerstein Jul 16, 2024
ed1cdc5
working on tuples of length 3
jhellerstein Jul 23, 2024
4fb02e6
checkpoint before contains_key refactor to trait
jhellerstein Jul 23, 2024
6053d81
starting over on a GhtForest trait
jhellerstein Jul 29, 2024
2dcdd6e
Merge remote-tracking branch 'origin/main' into feature/ght
jhellerstein Jul 30, 2024
93f0126
find_containing_leaf and GhtForest initial versions
jhellerstein Aug 2, 2024
ec70163
checkpoint WIP
jhellerstein Aug 9, 2024
ea2e790
WIP
jhellerstein Aug 12, 2024
27d34ce
BiMorphisms working again
jhellerstein Aug 12, 2024
231d52d
semi-stable with full rows in the leaves
jhellerstein Aug 12, 2024
9a12cee
find_leaf_node now working
jhellerstein Aug 13, 2024
5049945
WIP using unref_ref()
jhellerstein Aug 13, 2024
dc37fc2
checkpoint with leaves holding full tuples
jhellerstein Aug 15, 2024
a8051a0
tests passing!
jhellerstein Aug 15, 2024
239caae
remove redundant Schema and ValType from GHT
jhellerstein Aug 16, 2024
164e8fd
first implementation of force on forest compiling
jhellerstein Aug 20, 2024
01b1165
WIP on force testing
jhellerstein Aug 23, 2024
9e1278e
Ght macros, GhtForest and force seem to be working now
jhellerstein Aug 26, 2024
02176de
fix Ght height to be a static property
jhellerstein Aug 27, 2024
2941014
WIP on ColtNode
jhellerstein Aug 30, 2024
6600cbc
working ColtNode::get and ColtNode::iter
jhellerstein Aug 31, 2024
93844c4
WIP on get for ColtForest
jhellerstein Sep 9, 2024
b99a1fb
WIP
jhellerstein Sep 9, 2024
1f00c72
WIP get seems ok
jhellerstein Sep 9, 2024
6dfa872
clean up comments
jhellerstein Sep 10, 2024
816bc25
clean up lint errors
jhellerstein Sep 10, 2024
0b00929
checkpoint
jhellerstein Sep 10, 2024
54e4da9
working WIP
jhellerstein Sep 10, 2024
68eb115
removed options from ColtNode
jhellerstein Sep 10, 2024
15224ca
remove GhtKey
jhellerstein Sep 10, 2024
8f7d3e5
introduce an initial trie of type GhtLeaf in the Colt forest
jhellerstein Sep 11, 2024
f8ff17f
add Storage to GhtLeaf
jhellerstein Sep 16, 2024
775e367
feat(variadics): add variadic hash set
MingweiSamuel Sep 16, 2024
ca08cc2
TupleSet storage now working. On to Column Storage!
jhellerstein Sep 21, 2024
a54c5b9
columnstore now passing tests
jhellerstein Sep 25, 2024
31ec8e0
clean up GhtType macros
jhellerstein Sep 26, 2024
d423d77
clean up warnings
jhellerstein Sep 26, 2024
b4cb439
rename variadics/hash_set.rs to variadic_sets.rs and move VariadicCol…
jhellerstein Sep 26, 2024
43496b9
move TupleSet to variadics/variadic_set.rs
jhellerstein Sep 26, 2024
2e43f5a
move GhtTakeLeaf to ght_lazy.rs
jhellerstein Sep 26, 2024
d1309a0
cleanup
jhellerstein Sep 26, 2024
6a17c47
cleanup
jhellerstein Sep 26, 2024
73212b9
mostly working. variadic_sets.rs tests not quite done
jhellerstein Sep 27, 2024
4ab5d17
fix hashing on insrt for VariadicCountedHashSet
jhellerstein Sep 27, 2024
41bc04a
clean up variadics, still need to fix lattice tests
jhellerstein Sep 30, 2024
7540c69
clean up variadics
jhellerstein Sep 30, 2024
dd5ed5c
Merge remote-tracking branch 'origin/main' into feature/ght
jhellerstein Oct 8, 2024
943dcdf
fix macros/last ght not working 2024-10-10
jhellerstein Oct 10, 2024
dea8551
fix: ColtNode uses merge_node not Merge, tests pass
jhellerstein Oct 11, 2024
64a100e
clean up variadics
jhellerstein Sep 30, 2024
49ab408
wip
jhellerstein Oct 10, 2024
a11eea0
WIP
jhellerstein Oct 10, 2024
c739d05
storage WIP
jhellerstein Oct 10, 2024
a131e85
ColtNode complete
jhellerstein Oct 11, 2024
c973b2d
remove sealed from ght
jhellerstein Oct 13, 2024
27a8be3
wip: ght review
jhellerstein Oct 13, 2024
ba784a1
wip: initial review of ght.rs
jhellerstein Oct 13, 2024
5350674
clean up ght files
jhellerstein Oct 18, 2024
6680004
clean out dead tests
jhellerstein Oct 18, 2024
5c6d52f
reviewed. candidate for merge and push to main.
jhellerstein Oct 21, 2024
d8a6fc3
pass format checks
jhellerstein Oct 21, 2024
cd51093
fix cargo doc error
jhellerstein Oct 21, 2024
72f81ca
revert code to remove bug in partial_cmp for GhtInner
jhellerstein Oct 22, 2024
4af4ecc
Merge remote-tracking branch 'origin/main' into HEAD
MingweiSamuel Oct 23, 2024
d236fdf
fix: complaints from clippy
jhellerstein Oct 22, 2024
88cae44
fix: fully quality all macros used in ght_macros.rs
jhellerstein Oct 22, 2024
d1c191b
fix: remove dead file
jhellerstein Oct 23, 2024
698e57c
fix: update error messages from tests
jhellerstein Oct 23, 2024
64d8442
fix: clippy on latest-nightly is more strict about comments
jhellerstein Oct 23, 2024
5cc5c37
fix: address review comments on variadics
jhellerstein Oct 23, 2024
24454c3
fix: address additional clippy complaints from latest-nightly
jhellerstein Oct 25, 2024
37d1f26
fix: address review comments
jhellerstein Oct 25, 2024
7d8b610
fix: move comments from `lib.rs` to mod files
jhellerstein Oct 25, 2024
a3d74ea
fix: clean up comment placement
jhellerstein Oct 25, 2024
d2d9be4
fix: better doc examples for Ght Macros
jhellerstein Oct 25, 2024
8baf8f8
replace `static_height` with `const HEIGHT`
jhellerstein Oct 25, 2024
ff1041a
remove stale commented-out code
jhellerstein Oct 25, 2024
c3edffe
fix: PartialOrd for GhtInner can exit early
jhellerstein Oct 25, 2024
1ab0220
fix: move ght code to subdir
jhellerstein Oct 25, 2024
bcb82bd
fix: change refs to ght code to use subdir
jhellerstein Oct 25, 2024
9b5fdab
fix: remove commented dead code
jhellerstein Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ members = [
"stageleft_tool",
"topolotree",
"variadics",
"variadics_macro",
"website_playground",
]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,3 @@ Hello 6
Hello 7
Hello 8
Hello 9

Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,3 @@ digraph {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -67,4 +67,3 @@ subgraph sg_4v1 ["sg_4v1 stratum 1"]
9v1
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ subgraph sg_3v1 ["sg_3v1 stratum 1"]
3v1
end
end

Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ digraph {
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,3 @@ subgraph sg_2v1 ["sg_2v1 stratum 0"]
3v1
end
end

52 changes: 52 additions & 0 deletions hydroflow/tests/surface_lattice_bimorphism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ use std::collections::{HashMap, HashSet};

use hydroflow::util::collect_ready;
use hydroflow::{assert_graphvis_snapshots, hydroflow_syntax};
use lattices::ght::GeneralizedHashTrieNode;
use lattices::ght_lattice::{DeepJoinLatticeBimorphism, GhtBimorphism};
use lattices::map_union::{KeyedBimorphism, MapUnionHashMap, MapUnionSingletonMap};
use lattices::set_union::{CartesianProductBimorphism, SetUnionHashSet, SetUnionSingletonSet};
use lattices::GhtType;
use multiplatform_test::multiplatform_test;
use variadics::variadic_collections::VariadicHashSet;
use variadics::CloneVariadic;

#[multiplatform_test]
pub fn test_cartesian_product() {
Expand Down Expand Up @@ -134,3 +139,50 @@ pub fn test_cartesian_product_tick_state() {
&*collect_ready::<Vec<_>, _>(&mut out_recv)
);
}

#[test]
fn test_ght_join_bimorphism() {
type MyGhtATrie = GhtType!(u32, u64, u16 => &'static str: VariadicHashSet);
type MyGhtBTrie = GhtType!(u32, u64, u16 => &'static str: VariadicHashSet);

type JoinSchema = variadics::var_type!(u32, u64, u16, &'static str, &'static str);

type MyNodeBim = <(MyGhtATrie, MyGhtBTrie) as DeepJoinLatticeBimorphism<
VariadicHashSet<JoinSchema>,
>>::DeepJoinLatticeBimorphism;
type MyBim = GhtBimorphism<MyNodeBim>;

let mut hf = hydroflow_syntax! {
lhs = source_iter([
var_expr!(123, 2, 5, "hello"),
var_expr!(50, 1, 1, "hi"),
var_expr!(5, 1, 7, "hi"),
var_expr!(5, 1, 7, "bye"),
])
-> map(|row| MyGhtATrie::new_from([row]))
-> state::<'tick, MyGhtATrie>();
rhs = source_iter([
var_expr!(5, 1, 8, "hi"),
var_expr!(5, 1, 7, "world"),
var_expr!(5, 1, 7, "folks"),
var_expr!(10, 1, 2, "hi"),
var_expr!(12, 10, 98, "bye"),
])
-> map(|row| MyGhtBTrie::new_from([row]))
-> state::<'tick, MyGhtBTrie>();

lhs[items] -> [0]my_join;
rhs[items] -> [1]my_join;


my_join = lattice_bimorphism(MyBim::default(), #lhs, #rhs)
-> lattice_reduce()
-> enumerate()
-> inspect(|x| println!("{:?} {:#?}", context.current_tick(), x))
-> flat_map(|(_num, ght)| ght.recursive_iter().map(<JoinSchema as CloneVariadic>::clone_ref_var).collect::<Vec<_>>())
-> null();
// -> for_each(|x| println!("{:#?}\n", x));
};
// hf.meta_graph().unwrap().open_mermaid(&Default::default());
hf.run_available();
}
73 changes: 73 additions & 0 deletions hydroflow/tests/surface_lattice_generalized_hash_trie.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
use hydroflow::hydroflow_syntax;
use hydroflow::lattices::ght::GeneralizedHashTrieNode;
use hydroflow::lattices::ght_lattice::{DeepJoinLatticeBimorphism, GhtBimorphism};
use hydroflow::lattices::GhtType;
use hydroflow::util::collect_ready;
use hydroflow::variadics::{var_expr, var_type};
use variadics::variadic_collections::VariadicHashSet; // Import the Insert trait

#[test]
fn test_basic() {
type MyGht = GhtType!(u16, u32 => u64: VariadicHashSet);
type FlatTup = var_type!(u16, u32, u64);
let input: Vec<FlatTup> = vec![
var_expr!(42, 314, 43770),
var_expr!(42, 315, 43770),
var_expr!(42, 314, 30619),
var_expr!(43, 10, 600),
];
let mut merged = MyGht::default();
for i in input.clone() {
merged.insert(i);
}
println!("merged: {:?}", merged);
let mut df = hydroflow_syntax! {
source_iter(input)
-> map(|t| MyGht::new_from(vec![t]))
-> lattice_fold::<'static>(MyGht::default)
-> inspect(|t| println!("{:?}", t))
-> assert(|x: &MyGht| x.eq(&merged))
-> null();
};
df.run_available();
}

#[test]
fn test_join() {
type MyGht = GhtType!(u8 => u16: VariadicHashSet);
type ResultGht = GhtType!(u8 => u16, u16: VariadicHashSet);
let (out_send, out_recv) = hydroflow::util::unbounded_channel::<_>();

let r = vec![
var_expr!(1, 10),
var_expr!(2, 20),
var_expr!(3, 30),
var_expr!(4, 40),
];
let s = vec![var_expr!(1, 10), var_expr!(5, 50)];

type MyNodeBim = <(MyGht, MyGht) as DeepJoinLatticeBimorphism<
VariadicHashSet<var_type!(u8, u16, u16)>,
>>::DeepJoinLatticeBimorphism;
type MyBim = GhtBimorphism<MyNodeBim>;

let mut df = hydroflow_syntax! {
R = source_iter(r)
-> map(|t| MyGht::new_from([t]))
-> state::<MyGht>();
S = source_iter(s)
-> map(|t| MyGht::new_from([t]))
-> state::<MyGht>();
R[items] -> [0]my_join;
S[items] -> [1]my_join;
my_join = lattice_bimorphism(MyBim::default(), #R, #S)
-> lattice_reduce()
-> for_each(|x| out_send.send(x).unwrap());
};
df.run_available();

assert_eq!(
&[ResultGht::new_from(vec![var_expr!(1, 10, 10),])],
&*collect_ready::<Vec<_>, _>(out_recv)
);
}
5 changes: 2 additions & 3 deletions hydroflow_lang/src/graph/ops/anti_join_multiset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ use quote::{quote_spanned, ToTokens};
use syn::parse_quote;

use super::{
DelayType, OpInstGenerics, OperatorCategory, OperatorConstraints,
OperatorInstance, OperatorWriteOutput, Persistence, PortIndexValue, WriteContextArgs, RANGE_0,
RANGE_1,
DelayType, OpInstGenerics, OperatorCategory, OperatorConstraints, OperatorInstance,
OperatorWriteOutput, Persistence, PortIndexValue, WriteContextArgs, RANGE_0, RANGE_1,
};
use crate::diagnostic::{Diagnostic, Level};

Expand Down
3 changes: 3 additions & 0 deletions lattices/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ cc-traits = "2.0.0"
sealed = "0.5.0"
serde = { version = "1.0.197", features = ["derive"], optional = true }
lattices_macro = { path = "../lattices_macro", version = "^0.5.6" }
ref-cast = "1.0.23"
variadics = { path = "../variadics", version = "^0.0.6" }
variadics_macro = { path = "../variadics_macro", version = "^0.5.5" }

[dev-dependencies]
trybuild = "1.0.0"
Loading
Loading