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

Function collect_subquery_cols

datafusion/expr/src/utils.rs:1323–1338  ·  view source on GitHub ↗

Determine the set of [`Column`]s produced by the subquery.

(
    exprs: &[Expr],
    subquery_schema: &DFSchema,
)

Source from the content-addressed store, hash-verified

1321
1322/// Determine the set of [`Column`]s produced by the subquery.
1323pub fn collect_subquery_cols(
1324 exprs: &[Expr],
1325 subquery_schema: &DFSchema,
1326) -> Result<BTreeSet<Column>> {
1327 exprs.iter().try_fold(BTreeSet::new(), |mut cols, expr| {
1328 let mut using_cols: Vec<Column> = vec![];
1329 for col in expr.column_refs().into_iter() {
1330 if subquery_schema.has_column(col) {
1331 using_cols.push(col.clone());
1332 }
1333 }
1334
1335 cols.extend(using_cols);
1336 Result::<_>::Ok(cols)
1337 })
1338}
1339
1340#[cfg(test)]
1341mod tests {

Callers 2

f_upMethod · 0.85

Calls 8

newFunction · 0.85
column_refsMethod · 0.80
has_columnMethod · 0.80
iterMethod · 0.45
into_iterMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
extendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…