pub fn fmt_sql(expr: &dyn PhysicalExpr) -> impl Display + '_
Expand description
Prints a PhysicalExpr
in a SQL-like format
ยงExample
use std::collections::HashMap;
let expr: Arc<dyn PhysicalExpr> = make_physical_expr();
// wrap the expression in `sql_fmt` which can be used with
// `format!`, `to_string()`, etc
let expr_as_sql = fmt_sql(expr.as_ref());
assert_eq!(
"The SQL: CASE a > b THEN 1 ELSE 0 END",
format!("The SQL: {expr_as_sql}")
);