()
| 557 | |
| 558 | #[test] |
| 559 | fn test_partition_pruning_statistics() { |
| 560 | let partition_stats = partition_pruning_statistics_setup(); |
| 561 | |
| 562 | let column_a = Column::new_unqualified("a"); |
| 563 | let column_b = Column::new_unqualified("b"); |
| 564 | |
| 565 | // Partition values don't know anything about nulls or row counts |
| 566 | assert!(partition_stats.null_counts(&column_a).is_none()); |
| 567 | assert!(partition_stats.row_counts().is_none()); |
| 568 | assert!(partition_stats.null_counts(&column_b).is_none()); |
| 569 | assert!(partition_stats.row_counts().is_none()); |
| 570 | |
| 571 | // Min/max values are the same as the partition values |
| 572 | let min_values_a = |
| 573 | as_int32_array(&partition_stats.min_values(&column_a).unwrap()) |
| 574 | .unwrap() |
| 575 | .into_iter() |
| 576 | .collect::<Vec<_>>(); |
| 577 | let expected_values_a = vec![Some(1), Some(3)]; |
| 578 | assert_eq!(min_values_a, expected_values_a); |
| 579 | let max_values_a = |
| 580 | as_int32_array(&partition_stats.max_values(&column_a).unwrap()) |
| 581 | .unwrap() |
| 582 | .into_iter() |
| 583 | .collect::<Vec<_>>(); |
| 584 | let expected_values_a = vec![Some(1), Some(3)]; |
| 585 | assert_eq!(max_values_a, expected_values_a); |
| 586 | |
| 587 | let min_values_b = |
| 588 | as_int32_array(&partition_stats.min_values(&column_b).unwrap()) |
| 589 | .unwrap() |
| 590 | .into_iter() |
| 591 | .collect::<Vec<_>>(); |
| 592 | let expected_values_b = vec![Some(2), Some(4)]; |
| 593 | assert_eq!(min_values_b, expected_values_b); |
| 594 | let max_values_b = |
| 595 | as_int32_array(&partition_stats.max_values(&column_b).unwrap()) |
| 596 | .unwrap() |
| 597 | .into_iter() |
| 598 | .collect::<Vec<_>>(); |
| 599 | let expected_values_b = vec![Some(2), Some(4)]; |
| 600 | assert_eq!(max_values_b, expected_values_b); |
| 601 | |
| 602 | // Contained values are only true for the partition values |
| 603 | let values = HashSet::from([ScalarValue::from(1i32)]); |
| 604 | let contained_a = partition_stats.contained(&column_a, &values).unwrap(); |
| 605 | let expected_contained_a = BooleanArray::from(vec![true, false]); |
| 606 | assert_eq!(contained_a, expected_contained_a); |
| 607 | let contained_b = partition_stats.contained(&column_b, &values).unwrap(); |
| 608 | let expected_contained_b = BooleanArray::from(vec![false, false]); |
| 609 | assert_eq!(contained_b, expected_contained_b); |
| 610 | |
| 611 | // The number of containers is the length of the partition values |
| 612 | assert_eq!(partition_stats.num_containers(), 2); |
| 613 | } |
| 614 | |
| 615 | #[test] |
| 616 | fn test_partition_pruning_statistics_multiple_positive_values() { |
nothing calls this directly
no test coverage detected
searching dependent graphs…