MCPcopy Create free account
hub / github.com/erans/pgsqlite / test_nested_context_optimization

Function test_nested_context_optimization

src/rewriter/context_optimizer.rs:251–273  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

249
250 #[test]
251 fn test_nested_context_optimization() {
252 let mut optimizer = ContextOptimizer::new(300);
253
254 let mut outer = QueryContext {
255 default_table: Some("outer_table".to_string()),
256 ..Default::default()
257 };
258 outer.table_aliases.insert("o".to_string(), "outer_table".to_string());
259
260 let mut inner = QueryContext {
261 default_table: Some("inner_table".to_string()),
262 ..Default::default()
263 };
264 inner.table_aliases.insert("i".to_string(), "inner_table".to_string());
265
266 let optimized = optimizer.optimize_nested_context(&outer, vec![inner]);
267
268 // Inner context should override outer
269 assert_eq!(optimized.default_table, Some("inner_table".to_string()));
270 assert_eq!(optimized.table_aliases.len(), 2);
271 assert!(optimized.table_aliases.contains_key("o"));
272 assert!(optimized.table_aliases.contains_key("i"));
273 }
274}

Callers

nothing calls this directly

Calls 2

insertMethod · 0.45

Tested by

no test coverage detected