()
| 3682 | |
| 3683 | #[test] |
| 3684 | fn prune_decimal_data() { |
| 3685 | // decimal(9,2) |
| 3686 | let schema = Arc::new(Schema::new(vec![Field::new( |
| 3687 | "s1", |
| 3688 | DataType::Decimal128(9, 2), |
| 3689 | true, |
| 3690 | )])); |
| 3691 | |
| 3692 | prune_with_expr( |
| 3693 | // s1 > 5 |
| 3694 | col("s1").gt(lit(ScalarValue::Decimal128(Some(500), 9, 2))), |
| 3695 | &schema, |
| 3696 | // If the data is written by spark, the physical data type is INT32 in the parquet |
| 3697 | // So we use the INT32 type of statistic. |
| 3698 | &TestStatistics::new().with( |
| 3699 | "s1", |
| 3700 | ContainerStats::new_i32( |
| 3701 | vec![Some(0), Some(4), None, Some(3)], // min |
| 3702 | vec![Some(5), Some(6), Some(4), None], // max |
| 3703 | ), |
| 3704 | ), |
| 3705 | &[false, true, false, true], |
| 3706 | ); |
| 3707 | |
| 3708 | prune_with_expr( |
| 3709 | // with cast column to other type |
| 3710 | cast(col("s1"), DataType::Decimal128(14, 3)) |
| 3711 | .gt(lit(ScalarValue::Decimal128(Some(5000), 14, 3))), |
| 3712 | &schema, |
| 3713 | &TestStatistics::new().with( |
| 3714 | "s1", |
| 3715 | ContainerStats::new_i32( |
| 3716 | vec![Some(0), Some(4), None, Some(3)], // min |
| 3717 | vec![Some(5), Some(6), Some(4), None], // max |
| 3718 | ), |
| 3719 | ), |
| 3720 | &[false, true, false, true], |
| 3721 | ); |
| 3722 | |
| 3723 | prune_with_expr( |
| 3724 | // with try cast column to other type |
| 3725 | try_cast(col("s1"), DataType::Decimal128(14, 3)) |
| 3726 | .gt(lit(ScalarValue::Decimal128(Some(5000), 14, 3))), |
| 3727 | &schema, |
| 3728 | &TestStatistics::new().with( |
| 3729 | "s1", |
| 3730 | ContainerStats::new_i32( |
| 3731 | vec![Some(0), Some(4), None, Some(3)], // min |
| 3732 | vec![Some(5), Some(6), Some(4), None], // max |
| 3733 | ), |
| 3734 | ), |
| 3735 | &[false, true, false, true], |
| 3736 | ); |
| 3737 | |
| 3738 | // decimal(18,2) |
| 3739 | let schema = Arc::new(Schema::new(vec![Field::new( |
| 3740 | "s1", |
| 3741 | DataType::Decimal128(18, 2), |
nothing calls this directly
no test coverage detected
searching dependent graphs…