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

Function evaluate_expr_test

datafusion/core/tests/expr_api/mod.rs:394–410  ·  view source on GitHub ↗
(expr: Expr, expected_lines: Vec<&str>)

Source from the content-addressed store, hash-verified

392/// `RecordBatch` and compares the result to the expected result.
393#[expect(clippy::needless_pass_by_value)]
394fn evaluate_expr_test(expr: Expr, expected_lines: Vec<&str>) {
395 let batch = &TEST_BATCH;
396 let df_schema = DFSchema::try_from(batch.schema()).unwrap();
397 let physical_expr = SessionContext::new()
398 .create_physical_expr(expr, &df_schema)
399 .unwrap();
400
401 let result = physical_expr.evaluate(batch).unwrap();
402 let array = result.into_array(1).unwrap();
403 let result = pretty_format_columns("expr", &[array]).unwrap().to_string();
404 let actual_lines = result.lines().collect::<Vec<_>>();
405
406 assert_eq!(
407 expected_lines, actual_lines,
408 "\n\nexpected:\n\n{expected_lines:#?}\nactual:\n\n{actual_lines:#?}\n\n"
409 );
410}
411
412/// Creates the physical expression from Expr and compares the Debug expression
413/// to the expected result.

Callers 8

test_octet_lengthFunction · 0.85
test_eqFunction · 0.85
test_eq_with_coercionFunction · 0.85
test_get_fieldFunction · 0.85
test_get_field_nullFunction · 0.85
test_nested_get_fieldFunction · 0.85
test_list_indexFunction · 0.85
test_list_rangeFunction · 0.85

Calls 6

newFunction · 0.85
schemaMethod · 0.45
create_physical_exprMethod · 0.45
evaluateMethod · 0.45
into_arrayMethod · 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…