Evaluates the specified expr as an aggregate and compares the result to the expected result.
(expr: Expr, expected_lines: Vec<&str>)
| 367 | /// Evaluates the specified expr as an aggregate and compares the result to the |
| 368 | /// expected result. |
| 369 | async fn evaluate_agg_test(expr: Expr, expected_lines: Vec<&str>) { |
| 370 | let ctx = SessionContext::new(); |
| 371 | let group_expr = vec![]; |
| 372 | let agg_expr = vec![expr]; |
| 373 | let result = ctx |
| 374 | .read_batch(TEST_BATCH.clone()) |
| 375 | .unwrap() |
| 376 | .aggregate(group_expr, agg_expr) |
| 377 | .unwrap() |
| 378 | .collect() |
| 379 | .await |
| 380 | .unwrap(); |
| 381 | |
| 382 | let result = pretty_format_batches(&result).unwrap().to_string(); |
| 383 | let actual_lines = result.lines().collect::<Vec<_>>(); |
| 384 | |
| 385 | assert_eq!( |
| 386 | expected_lines, actual_lines, |
| 387 | "\n\nexpected:\n\n{expected_lines:#?}\nactual:\n\n{actual_lines:#?}\n\n" |
| 388 | ); |
| 389 | } |
| 390 | |
| 391 | /// Converts the `Expr` to a `PhysicalExpr`, evaluates it against the provided |
| 392 | /// `RecordBatch` and compares the result to the expected result. |
no test coverage detected
searching dependent graphs…