Extract SELECT projection items as raw SQL text strings.
(expr: &SetExpr)
| 203 | |
| 204 | /// Extract SELECT projection items as raw SQL text strings. |
| 205 | fn extract_select_exprs_as_text(expr: &SetExpr) -> Option<Vec<String>> { |
| 206 | let select = match expr { |
| 207 | SetExpr::Select(s) => s, |
| 208 | _ => return None, |
| 209 | }; |
| 210 | Some( |
| 211 | select |
| 212 | .projection |
| 213 | .iter() |
| 214 | .map(|item| match item { |
| 215 | ast::SelectItem::UnnamedExpr(e) => format!("{e}"), |
| 216 | ast::SelectItem::ExprWithAlias { expr: e, .. } => format!("{e}"), |
| 217 | ast::SelectItem::Wildcard(_) => "*".into(), |
| 218 | ast::SelectItem::QualifiedWildcard(name, _) => format!("{name}.*"), |
| 219 | }) |
| 220 | .collect(), |
| 221 | ) |
| 222 | } |
| 223 | |
| 224 | /// Extract step SELECT expressions and optional WHERE condition as SQL text. |
| 225 | /// |
no test coverage detected