Determine the set of [`Column`]s produced by the subquery.
(
exprs: &[Expr],
subquery_schema: &DFSchema,
)
| 1321 | |
| 1322 | /// Determine the set of [`Column`]s produced by the subquery. |
| 1323 | pub 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)] |
| 1341 | mod tests { |
no test coverage detected
searching dependent graphs…