()
| 2474 | |
| 2475 | #[test] |
| 2476 | fn prune_all_rows_null_counts() { |
| 2477 | // if null_count = row_count then we should prune the container for i = 0 |
| 2478 | // regardless of the statistics |
| 2479 | let schema = Arc::new(Schema::new(vec![Field::new("i", DataType::Int32, true)])); |
| 2480 | let statistics = TestStatistics::new().with( |
| 2481 | "i", |
| 2482 | ContainerStats::new_i32( |
| 2483 | vec![Some(0)], // min |
| 2484 | vec![Some(0)], // max |
| 2485 | ) |
| 2486 | .with_null_counts(vec![Some(1)]) |
| 2487 | .with_row_counts(vec![Some(1)]), |
| 2488 | ); |
| 2489 | let expected_ret = &[false]; |
| 2490 | prune_with_expr(col("i").eq(lit(0)), &schema, &statistics, expected_ret); |
| 2491 | |
| 2492 | // this should be true even if the container stats are missing |
| 2493 | let schema = Arc::new(Schema::new(vec![Field::new("i", DataType::Int32, true)])); |
| 2494 | let container_stats = ContainerStats { |
| 2495 | min: Some(Arc::new(Int32Array::from(vec![None]))), |
| 2496 | max: Some(Arc::new(Int32Array::from(vec![None]))), |
| 2497 | null_counts: Some(Arc::new(UInt64Array::from(vec![Some(1)]))), |
| 2498 | row_counts: Some(Arc::new(UInt64Array::from(vec![Some(1)]))), |
| 2499 | ..ContainerStats::default() |
| 2500 | }; |
| 2501 | let statistics = TestStatistics::new().with("i", container_stats); |
| 2502 | let expected_ret = &[false]; |
| 2503 | prune_with_expr(col("i").eq(lit(0)), &schema, &statistics, expected_ret); |
| 2504 | |
| 2505 | // If the null counts themselves are missing we should be able to fall back to the stats |
| 2506 | let schema = Arc::new(Schema::new(vec![Field::new("i", DataType::Int32, true)])); |
| 2507 | let container_stats = ContainerStats { |
| 2508 | min: Some(Arc::new(Int32Array::from(vec![Some(0)]))), |
| 2509 | max: Some(Arc::new(Int32Array::from(vec![Some(0)]))), |
| 2510 | null_counts: Some(Arc::new(UInt64Array::from(vec![None]))), |
| 2511 | row_counts: Some(Arc::new(UInt64Array::from(vec![Some(1)]))), |
| 2512 | ..ContainerStats::default() |
| 2513 | }; |
| 2514 | let statistics = TestStatistics::new().with("i", container_stats); |
| 2515 | let expected_ret = &[true]; |
| 2516 | prune_with_expr(col("i").eq(lit(0)), &schema, &statistics, expected_ret); |
| 2517 | let expected_ret = &[false]; |
| 2518 | prune_with_expr(col("i").gt(lit(0)), &schema, &statistics, expected_ret); |
| 2519 | |
| 2520 | // Same for the row counts |
| 2521 | let schema = Arc::new(Schema::new(vec![Field::new("i", DataType::Int32, true)])); |
| 2522 | let container_stats = ContainerStats { |
| 2523 | min: Some(Arc::new(Int32Array::from(vec![Some(0)]))), |
| 2524 | max: Some(Arc::new(Int32Array::from(vec![Some(0)]))), |
| 2525 | null_counts: Some(Arc::new(UInt64Array::from(vec![Some(1)]))), |
| 2526 | row_counts: Some(Arc::new(UInt64Array::from(vec![None]))), |
| 2527 | ..ContainerStats::default() |
| 2528 | }; |
| 2529 | let statistics = TestStatistics::new().with("i", container_stats); |
| 2530 | let expected_ret = &[true]; |
| 2531 | prune_with_expr(col("i").eq(lit(0)), &schema, &statistics, expected_ret); |
| 2532 | let expected_ret = &[false]; |
| 2533 | prune_with_expr(col("i").gt(lit(0)), &schema, &statistics, expected_ret); |
nothing calls this directly
no test coverage detected
searching dependent graphs…