Extract `IN (SELECT ...)` and `NOT IN (SELECT ...)` patterns from a WHERE clause. Returns the extracted subquery joins and the remaining WHERE expression (with subquery predicates removed). If the entire WHERE is a single subquery predicate, `remaining_where` is `None`.
(
expr: &Expr,
catalog: &dyn SqlCatalog,
functions: &FunctionRegistry,
temporal: crate::TemporalScope,
)
| 47 | /// (with subquery predicates removed). If the entire WHERE is a single |
| 48 | /// subquery predicate, `remaining_where` is `None`. |
| 49 | pub fn extract_subqueries( |
| 50 | expr: &Expr, |
| 51 | catalog: &dyn SqlCatalog, |
| 52 | functions: &FunctionRegistry, |
| 53 | temporal: crate::TemporalScope, |
| 54 | ) -> Result<SubqueryExtraction> { |
| 55 | let mut joins = Vec::new(); |
| 56 | let remaining = extract_recursive(expr, &mut joins, catalog, functions, temporal)?; |
| 57 | Ok(SubqueryExtraction { |
| 58 | joins, |
| 59 | remaining_where: remaining, |
| 60 | }) |
| 61 | } |
| 62 | |
| 63 | /// Recursively walk the WHERE expression, extracting subquery predicates. |
| 64 | /// |
no test coverage detected