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

Function test_sql_to_expr_with_alias

datafusion/sql/src/expr/mod.rs:1502–1521  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1500 test_stack_overflow!(test_stack_overflow_8192, 8192);
1501 #[test]
1502 fn test_sql_to_expr_with_alias() {
1503 let schema = DFSchema::empty();
1504 let mut planner_context = PlannerContext::default();
1505
1506 let expr_str = "SUM(int_col) as sum_int_col";
1507
1508 let dialect = GenericDialect {};
1509 let mut parser = Parser::new(&dialect).try_with_sql(expr_str).unwrap();
1510 // from sqlparser
1511 let sql_expr = parser.parse_expr_with_alias().unwrap();
1512
1513 let context_provider = TestContextProvider::new();
1514 let sql_to_rel = SqlToRel::new(&context_provider);
1515
1516 let expr = sql_to_rel
1517 .sql_expr_to_logical_expr_with_alias(sql_expr, &schema, &mut planner_context)
1518 .unwrap();
1519
1520 assert!(matches!(expr, Expr::Alias(_)));
1521 }
1522}

Callers

nothing calls this directly

Calls 3

newFunction · 0.85
emptyFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…