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

Function custom_dialect_division_operator

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

Source from the content-addressed store, hash-verified

3062
3063 #[test]
3064 fn custom_dialect_division_operator() -> Result<()> {
3065 let default_dialect = CustomDialectBuilder::new().build();
3066 let duckdb_dialect = CustomDialectBuilder::new()
3067 .with_division_operator(BinaryOperator::DuckIntegerDivide)
3068 .build();
3069
3070 for (dialect, expected) in
3071 [(default_dialect, "(a / b)"), (duckdb_dialect, "(a // b)")]
3072 {
3073 let unparser = Unparser::new(&dialect);
3074 let expr = Expr::BinaryExpr(BinaryExpr {
3075 left: Box::new(col("a")),
3076 op: Operator::Divide,
3077 right: Box::new(col("b")),
3078 });
3079 let ast = unparser.expr_to_sql(&expr)?;
3080
3081 let actual = format!("{ast}");
3082 let expected = expected.to_string();
3083
3084 assert_eq!(actual, expected);
3085 }
3086 Ok(())
3087 }
3088
3089 #[test]
3090 fn test_mssql_dialect_national_literal() -> Result<()> {

Callers

nothing calls this directly

Calls 7

newFunction · 0.85
expr_to_sqlMethod · 0.80
BinaryExprClass · 0.50
colFunction · 0.50
buildMethod · 0.45
to_stringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…