Given an expression, returns the index of the input whose columns fully cover the expression's column references. Returns `None` if the expression references columns from multiple inputs or if multiple inputs match (ambiguous, e.g. unqualified columns present in both sides of a join).
(
expr: &Expr,
input_column_sets: &[std::collections::HashSet<ColumnReference>],
)
| 270 | /// or if multiple inputs match (ambiguous, e.g. unqualified columns present |
| 271 | /// in both sides of a join). |
| 272 | fn find_owning_input( |
| 273 | expr: &Expr, |
| 274 | input_column_sets: &[std::collections::HashSet<ColumnReference>], |
| 275 | ) -> Option<usize> { |
| 276 | let mut found = None; |
| 277 | for (idx, cols) in input_column_sets.iter().enumerate() { |
| 278 | if has_all_column_refs(expr, cols) { |
| 279 | if found.is_some() { |
| 280 | // Ambiguous — multiple inputs match |
| 281 | return None; |
| 282 | } |
| 283 | found = Some(idx); |
| 284 | } |
| 285 | } |
| 286 | found |
| 287 | } |
| 288 | |
| 289 | /// Walks an expression tree top-down, extracting `MoveTowardsLeafNodes` |
| 290 | /// sub-expressions and routing each to the correct per-input extractor. |
no test coverage detected
searching dependent graphs…