Generate a relational expression from a SQL expression
(
&self,
sql: SQLExpr,
schema: &DFSchema,
planner_context: &mut PlannerContext,
)
| 165 | |
| 166 | /// Generate a relational expression from a SQL expression |
| 167 | pub fn sql_to_expr( |
| 168 | &self, |
| 169 | sql: SQLExpr, |
| 170 | schema: &DFSchema, |
| 171 | planner_context: &mut PlannerContext, |
| 172 | ) -> Result<Expr> { |
| 173 | // The location of the original SQL expression in the source code |
| 174 | let mut expr = self.sql_expr_to_logical_expr(sql, schema, planner_context)?; |
| 175 | expr = self.rewrite_partial_qualifier(expr, schema); |
| 176 | self.validate_schema_satisfies_exprs(schema, std::slice::from_ref(&expr))?; |
| 177 | let (expr, _) = expr.infer_placeholder_types(schema)?; |
| 178 | Ok(expr) |
| 179 | } |
| 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 { |