(expr: Expr, expected_lines: Vec<&str>)
| 392 | /// `RecordBatch` and compares the result to the expected result. |
| 393 | #[expect(clippy::needless_pass_by_value)] |
| 394 | fn 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. |
no test coverage detected
searching dependent graphs…