MCPcopy Create free account
hub / github.com/apache/datafusion / test_insert_intersection

Function test_insert_intersection

datafusion/optimizer/src/join_key_set.rs:219–247  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

217
218 #[test]
219 fn test_insert_intersection() {
220 // a = b, b = c, c = d
221 let mut set1 = JoinKeySet::new();
222 set1.insert(&col("a"), &col("b"));
223 set1.insert(&col("b"), &col("c"));
224 set1.insert(&col("c"), &col("d"));
225
226 // a = a, b = b, b = c, d = c
227 // should only intersect on b = c and c = d
228 let mut set2 = JoinKeySet::new();
229 set2.insert(&col("a"), &col("a"));
230 set2.insert(&col("b"), &col("b"));
231 set2.insert(&col("b"), &col("c"));
232 set2.insert(&col("d"), &col("c"));
233
234 let mut set = JoinKeySet::new();
235 // put something in there already
236 set.insert(&col("x"), &col("y"));
237 set.insert_intersection(&set1, &set2);
238
239 assert_contents(
240 &set,
241 vec![
242 (&col("x"), &col("y")),
243 (&col("b"), &col("c")),
244 (&col("c"), &col("d")),
245 ],
246 );
247 }
248
249 fn assert_contents(set: &JoinKeySet, expected: Vec<(&Expr, &Expr)>) {
250 let contents: Vec<_> = set.iter().collect();

Callers

nothing calls this directly

Calls 5

newFunction · 0.85
assert_contentsFunction · 0.85
insert_intersectionMethod · 0.80
colFunction · 0.50
insertMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…