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

Function test_float_scalar_to_expr

datafusion/sql/src/unparser/expr.rs:2777–2802  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2775
2776 #[test]
2777 fn test_float_scalar_to_expr() {
2778 let tests = [
2779 (Expr::Literal(ScalarValue::Float64(Some(3f64)), None), "3.0"),
2780 (
2781 Expr::Literal(ScalarValue::Float64(Some(3.1f64)), None),
2782 "3.1",
2783 ),
2784 (
2785 Expr::Literal(ScalarValue::Float32(Some(-2f32)), None),
2786 "-2.0",
2787 ),
2788 (
2789 Expr::Literal(ScalarValue::Float32(Some(-2.989f32)), None),
2790 "-2.989",
2791 ),
2792 ];
2793 for (value, expected) in tests {
2794 let dialect = CustomDialectBuilder::new().build();
2795 let unparser = Unparser::new(&dialect);
2796
2797 let ast = unparser.expr_to_sql(&value).expect("to be unparsed");
2798 let actual = format!("{ast}");
2799
2800 assert_eq!(actual, expected);
2801 }
2802 }
2803
2804 #[test]
2805 fn test_cast_value_to_binary_expr() {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
expr_to_sqlMethod · 0.80
LiteralInterface · 0.50
buildMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…