(items: &mut Vec<SelectItem>)
| 121 | } |
| 122 | |
| 123 | fn deduplicate_select_items(items: &mut Vec<SelectItem>) { |
| 124 | // Dropping all duplicated identifiers |
| 125 | let mut seen = HashSet::new(); |
| 126 | items.retain(|select_item| match select_item { |
| 127 | SelectItem::UnnamedExpr(sql_ast::Expr::CompoundIdentifier(idents)) => { |
| 128 | // If any of the identifiers hadn't been seen yet, retain the expr |
| 129 | idents.iter().any(|ident| seen.insert(ident.clone())) |
| 130 | } |
| 131 | SelectItem::ExprWithAlias { alias, .. } => seen.insert(alias.clone()), |
| 132 | _ => true, |
| 133 | }); |
| 134 | } |
| 135 | |
| 136 | pub(super) fn translate_select_items( |
| 137 | cols: Vec<CId>, |
no test coverage detected