Rewrite aliases which are not-complete (e.g. ones that only include only table qualifier in a schema.table qualified relation)
(&self, expr: Expr, schema: &DFSchema)
| 180 | |
| 181 | /// Rewrite aliases which are not-complete (e.g. ones that only include only table qualifier in a schema.table qualified relation) |
| 182 | fn rewrite_partial_qualifier(&self, expr: Expr, schema: &DFSchema) -> Expr { |
| 183 | match expr { |
| 184 | Expr::Column(col) => match &col.relation { |
| 185 | Some(q) => { |
| 186 | match schema.iter().find(|(qualifier, field)| match qualifier { |
| 187 | Some(field_q) => { |
| 188 | field.name() == &col.name |
| 189 | && field_q.to_string().ends_with(&format!(".{q}")) |
| 190 | } |
| 191 | _ => false, |
| 192 | }) { |
| 193 | Some((qualifier, df_field)) => Expr::from((qualifier, df_field)), |
| 194 | None => Expr::Column(col), |
| 195 | } |
| 196 | } |
| 197 | None => Expr::Column(col), |
| 198 | }, |
| 199 | _ => expr, |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | /// Internal implementation. Use |
| 204 | /// [`Self::sql_expr_to_logical_expr`] to plan exprs. |
no test coverage detected