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

Function find_owning_input

datafusion/optimizer/src/extract_leaf_expressions.rs:272–287  ·  view source on GitHub ↗

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>],
)

Source from the content-addressed store, hash-verified

270/// or if multiple inputs match (ambiguous, e.g. unqualified columns present
271/// in both sides of a join).
272fn 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.

Callers 2

routing_extractFunction · 0.85
route_to_inputsFunction · 0.85

Calls 2

has_all_column_refsFunction · 0.85
iterMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…