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

Function format_cast

datafusion/expr/src/expr.rs:3916–3927  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3914
3915 #[test]
3916 fn format_cast() -> Result<()> {
3917 let expr = Expr::Cast(Cast {
3918 expr: Box::new(Expr::Literal(ScalarValue::Float32(Some(1.23)), None)),
3919 field: DataType::Utf8.into_nullable_field_ref(),
3920 });
3921 let expected_canonical = "CAST(Float32(1.23) AS Utf8)";
3922 assert_eq!(expected_canonical, format!("{expr}"));
3923 // Note that CAST intentionally has a name that is different from its `Display`
3924 // representation. CAST does not change the name of expressions.
3925 assert_eq!("Float32(1.23)", expr.schema_name().to_string());
3926 Ok(())
3927 }
3928
3929 #[test]
3930 fn test_partial_ord() {

Callers

nothing calls this directly

Calls 4

CastClass · 0.85
newFunction · 0.85
LiteralInterface · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…