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

Function expr_to_sql

datafusion/sql/src/unparser/expr.rs:85–88  ·  view source on GitHub ↗

Convert a DataFusion [`Expr`] to [`ast::Expr`] This function is the opposite of [`SqlToRel::sql_to_expr`] and can be used to, among other things, convert [`Expr`]s to SQL strings. Such strings could be used to pass filters or other expressions to another SQL engine. # Errors Throws an error if [`Expr`] can not be represented by an [`ast::Expr`] # See Also [`Unparser`] for more control over th

(expr: &Expr)

Source from the content-addressed store, hash-verified

83/// [`plan_to_sql`]: crate::unparser::plan_to_sql
84/// [`LogicalPlan`]: datafusion_expr::logical_plan::LogicalPlan
85pub fn expr_to_sql(expr: &Expr) -> Result<ast::Expr> {
86 let unparser = Unparser::default();
87 unparser.expr_to_sql(expr)
88}
89
90const LOWEST: &BinaryOperator = &BinaryOperator::Or;
91// Closest precedence we have to IS operator is BitwiseAnd (any other) in PG docs

Callers 4

simple_expr_to_sql_demoFunction · 0.85
expr_to_sql_okFunction · 0.85
test_is_distinct_fromFunction · 0.85
roundtrip_exprFunction · 0.85

Calls 1

expr_to_sqlMethod · 0.80

Tested by 3

expr_to_sql_okFunction · 0.68
test_is_distinct_fromFunction · 0.68
roundtrip_exprFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…