()
| 724 | |
| 725 | #[test] |
| 726 | fn test_statistics_pruning_statistics() { |
| 727 | let statistics = vec![ |
| 728 | Arc::new( |
| 729 | Statistics::default() |
| 730 | .add_column_statistics( |
| 731 | ColumnStatistics::new_unknown() |
| 732 | .with_min_value(Precision::Exact(ScalarValue::from(0i32))) |
| 733 | .with_max_value(Precision::Exact(ScalarValue::from(100i32))) |
| 734 | .with_null_count(Precision::Exact(0)), |
| 735 | ) |
| 736 | .add_column_statistics( |
| 737 | ColumnStatistics::new_unknown() |
| 738 | .with_min_value(Precision::Exact(ScalarValue::from(100i32))) |
| 739 | .with_max_value(Precision::Exact(ScalarValue::from(200i32))) |
| 740 | .with_null_count(Precision::Exact(5)), |
| 741 | ) |
| 742 | .with_num_rows(Precision::Exact(100)), |
| 743 | ), |
| 744 | Arc::new( |
| 745 | Statistics::default() |
| 746 | .add_column_statistics( |
| 747 | ColumnStatistics::new_unknown() |
| 748 | .with_min_value(Precision::Exact(ScalarValue::from(50i32))) |
| 749 | .with_max_value(Precision::Exact(ScalarValue::from(300i32))) |
| 750 | .with_null_count(Precision::Exact(10)), |
| 751 | ) |
| 752 | .add_column_statistics( |
| 753 | ColumnStatistics::new_unknown() |
| 754 | .with_min_value(Precision::Exact(ScalarValue::from(200i32))) |
| 755 | .with_max_value(Precision::Exact(ScalarValue::from(400i32))) |
| 756 | .with_null_count(Precision::Exact(0)), |
| 757 | ) |
| 758 | .with_num_rows(Precision::Exact(200)), |
| 759 | ), |
| 760 | ]; |
| 761 | |
| 762 | let schema = Arc::new(Schema::new(vec![ |
| 763 | Field::new("a", DataType::Int32, false), |
| 764 | Field::new("b", DataType::Int32, false), |
| 765 | Field::new("c", DataType::Int32, false), |
| 766 | ])); |
| 767 | let pruning_stats = PrunableStatistics::new(statistics, schema); |
| 768 | |
| 769 | let column_a = Column::new_unqualified("a"); |
| 770 | let column_b = Column::new_unqualified("b"); |
| 771 | |
| 772 | // Min/max values are the same as the statistics |
| 773 | let min_values_a = as_int32_array(&pruning_stats.min_values(&column_a).unwrap()) |
| 774 | .unwrap() |
| 775 | .into_iter() |
| 776 | .collect::<Vec<_>>(); |
| 777 | let expected_values_a = vec![Some(0), Some(50)]; |
| 778 | assert_eq!(min_values_a, expected_values_a); |
| 779 | let max_values_a = as_int32_array(&pruning_stats.max_values(&column_a).unwrap()) |
| 780 | .unwrap() |
| 781 | .into_iter() |
| 782 | .collect::<Vec<_>>(); |
| 783 | let expected_values_a = vec![Some(100), Some(300)]; |
nothing calls this directly
no test coverage detected
searching dependent graphs…