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

Function mock_session_state

datafusion/sql/tests/sql_integration.rs:3547–3586  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

3545}
3546
3547fn mock_session_state() -> MockSessionState {
3548 MockSessionState::default()
3549 .with_scalar_function(Arc::new(unicode::character_length().as_ref().clone()))
3550 .with_scalar_function(Arc::new(string::concat().as_ref().clone()))
3551 .with_scalar_function(Arc::new(make_udf(
3552 "nullif",
3553 vec![DataType::Int32, DataType::Int32],
3554 DataType::Int32,
3555 )))
3556 .with_scalar_function(Arc::new(make_udf(
3557 "round",
3558 vec![DataType::Float64, DataType::Int64],
3559 DataType::Float32,
3560 )))
3561 .with_scalar_function(Arc::new(make_udf(
3562 "arrow_cast",
3563 vec![DataType::Int64, DataType::Utf8],
3564 DataType::Float64,
3565 )))
3566 .with_scalar_function(Arc::new(make_udf(
3567 "date_trunc",
3568 vec![DataType::Utf8, DataType::Timestamp(Nanosecond, None)],
3569 DataType::Int32,
3570 )))
3571 .with_scalar_function(Arc::new(make_udf(
3572 "sqrt",
3573 vec![DataType::Int64],
3574 DataType::Int64,
3575 )))
3576 .with_aggregate_function(sum_udaf())
3577 .with_aggregate_function(approx_median_udaf())
3578 .with_aggregate_function(count_udaf())
3579 .with_aggregate_function(avg_udaf())
3580 .with_aggregate_function(min_udaf())
3581 .with_aggregate_function(max_udaf())
3582 .with_aggregate_function(grouping_udaf())
3583 .with_window_function(rank_udwf())
3584 .with_window_function(row_number_udwf())
3585 .with_expr_planner(Arc::new(CoreFunctionPlanner::default()))
3586}
3587
3588fn logical_plan_from_state(
3589 sql: &str,

Calls 10

newFunction · 0.85
make_udfFunction · 0.85
with_window_functionMethod · 0.80
with_scalar_functionMethod · 0.80
character_lengthFunction · 0.50
concatFunction · 0.50
with_expr_plannerMethod · 0.45
cloneMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…