MCPcopy Create free account
hub / github.com/comnik/declarative-dataflow / collection_collection

Function collection_collection

src/plan/join.rs:120–181  ·  view source on GitHub ↗
(
    nested: &mut Iterative<'b, S, u64>,
    context: &mut I,
    target_variables: &[Var],
    left: CollectionRelation<'b, S>,
    right: CollectionRelation<'b, S>,
)

Source from the content-addressed store, hash-verified

118}
119
120fn collection_collection<'b, T, S, I>(
121 nested: &mut Iterative<'b, S, u64>,
122 context: &mut I,
123 target_variables: &[Var],
124 left: CollectionRelation<'b, S>,
125 right: CollectionRelation<'b, S>,
126) -> (Implemented<'b, S>, ShutdownHandle)
127where
128 T: Timestamp + Lattice,
129 I: ImplContext<T>,
130 S: Scope<Timestamp = T>,
131{
132 let mut shutdown_handle = ShutdownHandle::empty();
133
134 let variables = target_variables
135 .iter()
136 .cloned()
137 .chain(
138 left.variables()
139 .drain(..)
140 .filter(|x| !target_variables.contains(x)),
141 )
142 .chain(
143 right
144 .variables()
145 .drain(..)
146 .filter(|x| !target_variables.contains(x)),
147 )
148 .collect();
149
150 let left_arranged: Arranged<
151 Iterative<'b, S, u64>,
152 TraceValHandle<Vec<Value>, Vec<Value>, Product<S::Timestamp, u64>, isize>,
153 > = {
154 let (arranged, shutdown) = left.tuples_by_variables(nested, context, &target_variables);
155 shutdown_handle.merge_with(shutdown);
156 arranged.arrange()
157 };
158
159 let right_arranged: Arranged<
160 Iterative<'b, S, u64>,
161 TraceValHandle<Vec<Value>, Vec<Value>, Product<S::Timestamp, u64>, isize>,
162 > = {
163 let (arranged, shutdown) = right.tuples_by_variables(nested, context, &target_variables);
164 shutdown_handle.merge_with(shutdown);
165 arranged.arrange()
166 };
167
168 let tuples = left_arranged.join_core(&right_arranged, |key: &Vec<Value>, v1, v2| {
169 Some(
170 key.iter()
171 .cloned()
172 .chain(v1.iter().cloned())
173 .chain(v2.iter().cloned())
174 .collect(),
175 )
176 });
177

Callers 2

collection_attributeFunction · 0.85
implementMethod · 0.85

Calls 3

tuples_by_variablesMethod · 0.80
merge_withMethod · 0.80
variablesMethod · 0.45

Tested by

no test coverage detected