MCPcopy Create free account
hub / github.com/apache/datafusion / sql_to_expr

Method sql_to_expr

datafusion/sql/src/expr/mod.rs:167–179  ·  view source on GitHub ↗

Generate a relational expression from a SQL expression

(
        &self,
        sql: SQLExpr,
        schema: &DFSchema,
        planner_context: &mut PlannerContext,
    )

Source from the content-addressed store, hash-verified

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 {

Callers 15

plan_relationMethod · 0.45
plan_relationMethod · 0.45
plan_pivotFunction · 0.45
plan_unpivotFunction · 0.45
plan_selectionMethod · 0.45
sql_select_to_rexMethod · 0.45
sql_values_to_planMethod · 0.45
build_column_defaultsMethod · 0.45
delete_to_planMethod · 0.45
update_to_planMethod · 0.45
limitMethod · 0.45

Tested by 3

roundtrip_exprFunction · 0.36
test_pretty_roundtripFunction · 0.36