| 3783 | |
| 3784 | #[test] |
| 3785 | fn prune_api() { |
| 3786 | let schema = Arc::new(Schema::new(vec![ |
| 3787 | Field::new("s1", DataType::Utf8, true), |
| 3788 | Field::new("s2", DataType::Int32, true), |
| 3789 | ])); |
| 3790 | |
| 3791 | let statistics = TestStatistics::new().with( |
| 3792 | "s2", |
| 3793 | ContainerStats::new_i32( |
| 3794 | vec![Some(0), Some(4), None, Some(3)], // min |
| 3795 | vec![Some(5), Some(6), None, None], // max |
| 3796 | ), |
| 3797 | ); |
| 3798 | prune_with_expr( |
| 3799 | // Prune using s2 > 5 |
| 3800 | col("s2").gt(lit(5)), |
| 3801 | &schema, |
| 3802 | &statistics, |
| 3803 | // s2 [0, 5] ==> no rows should pass |
| 3804 | // s2 [4, 6] ==> some rows could pass |
| 3805 | // No stats for s2 ==> some rows could pass |
| 3806 | // s2 [3, None] (null max) ==> some rows could pass |
| 3807 | &[false, true, true, true], |
| 3808 | ); |
| 3809 | |
| 3810 | prune_with_expr( |
| 3811 | // filter with cast |
| 3812 | cast(col("s2"), DataType::Int64).gt(lit(ScalarValue::Int64(Some(5)))), |
| 3813 | &schema, |
| 3814 | &statistics, |
| 3815 | &[false, true, true, true], |
| 3816 | ); |
| 3817 | } |
| 3818 | |
| 3819 | #[test] |
| 3820 | fn prune_not_eq_data() { |