@@ -462,8 +462,8 @@ mod tests {
462
462
#[ test]
463
463
fn test_partition_pruning_statistics ( ) {
464
464
let partition_values = vec ! [
465
- vec![ ScalarValue :: Int32 ( Some ( 1 ) ) , ScalarValue :: Int32 ( Some ( 2 ) ) ] ,
466
- vec![ ScalarValue :: Int32 ( Some ( 3 ) ) , ScalarValue :: Int32 ( Some ( 4 ) ) ] ,
465
+ vec![ ScalarValue :: from ( 1i32 ) , ScalarValue :: from ( 2i32 ) ] ,
466
+ vec![ ScalarValue :: from ( 3i32 ) , ScalarValue :: from ( 4i32 ) ] ,
467
467
] ;
468
468
let partition_fields = vec ! [
469
469
Arc :: new( Field :: new( "a" , DataType :: Int32 , false ) ) ,
@@ -513,7 +513,7 @@ mod tests {
513
513
assert_eq ! ( max_values_b, expected_values_b) ;
514
514
515
515
// Contained values are only true for the partition values
516
- let values = HashSet :: from ( [ ScalarValue :: Int32 ( Some ( 1 ) ) ] ) ;
516
+ let values = HashSet :: from ( [ ScalarValue :: from ( 1i32 ) ] ) ;
517
517
let contained_a = partition_stats. contained ( & column_a, & values) . unwrap ( ) ;
518
518
let expected_contained_a = BooleanArray :: from ( vec ! [ true , false ] ) ;
519
519
assert_eq ! ( contained_a, expected_contained_a) ;
@@ -551,7 +551,7 @@ mod tests {
551
551
assert ! ( partition_stats. max_values( & column_b) . is_none( ) ) ;
552
552
553
553
// Contained values are all empty
554
- let values = HashSet :: from ( [ ScalarValue :: Int32 ( Some ( 1 ) ) ] ) ;
554
+ let values = HashSet :: from ( [ ScalarValue :: from ( 1i32 ) ] ) ;
555
555
let contained_a = partition_stats. contained ( & column_a, & values) ;
556
556
let expected_contained_a = BooleanArray :: from ( Vec :: < Option < bool > > :: new ( ) ) ;
557
557
assert_eq ! ( contained_a, Some ( expected_contained_a) ) ;
@@ -564,20 +564,14 @@ mod tests {
564
564
Statistics :: default ( )
565
565
. add_column_statistics(
566
566
ColumnStatistics :: new_unknown( )
567
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some ( 0 ) ) ) )
568
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
569
- 100 ,
570
- ) ) ) )
567
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 0i32 ) ) )
568
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 100i32 ) ) )
571
569
. with_null_count( Precision :: Exact ( 0 ) ) ,
572
570
)
573
571
. add_column_statistics(
574
572
ColumnStatistics :: new_unknown( )
575
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
576
- 100 ,
577
- ) ) ) )
578
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
579
- 200 ,
580
- ) ) ) )
573
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 100i32 ) ) )
574
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 200i32 ) ) )
581
575
. with_null_count( Precision :: Exact ( 5 ) ) ,
582
576
)
583
577
. with_num_rows( Precision :: Exact ( 100 ) ) ,
@@ -586,22 +580,14 @@ mod tests {
586
580
Statistics :: default ( )
587
581
. add_column_statistics(
588
582
ColumnStatistics :: new_unknown( )
589
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
590
- 50 ,
591
- ) ) ) )
592
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
593
- 300 ,
594
- ) ) ) )
583
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 50i32 ) ) )
584
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 300i32 ) ) )
595
585
. with_null_count( Precision :: Exact ( 10 ) ) ,
596
586
)
597
587
. add_column_statistics(
598
588
ColumnStatistics :: new_unknown( )
599
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
600
- 200 ,
601
- ) ) ) )
602
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
603
- 400 ,
604
- ) ) ) )
589
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 200i32 ) ) )
590
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 400i32 ) ) )
605
591
. with_null_count( Precision :: Exact ( 0 ) ) ,
606
592
)
607
593
. with_num_rows( Precision :: Exact ( 200 ) ) ,
@@ -675,7 +661,7 @@ mod tests {
675
661
assert_eq ! ( row_counts_b, expected_row_counts_b) ;
676
662
677
663
// Contained values are all null/missing (we can't know this just from statistics)
678
- let values = HashSet :: from ( [ ScalarValue :: Int32 ( Some ( 0 ) ) ] ) ;
664
+ let values = HashSet :: from ( [ ScalarValue :: from ( 0i32 ) ] ) ;
679
665
assert ! ( pruning_stats. contained( & column_a, & values) . is_none( ) ) ;
680
666
assert ! ( pruning_stats. contained( & column_b, & values) . is_none( ) ) ;
681
667
@@ -737,16 +723,16 @@ mod tests {
737
723
assert ! ( pruning_stats. row_counts( & column_b) . is_none( ) ) ;
738
724
739
725
// Contained values are all empty
740
- let values = HashSet :: from ( [ ScalarValue :: Int32 ( Some ( 1 ) ) ] ) ;
726
+ let values = HashSet :: from ( [ ScalarValue :: from ( 1i32 ) ] ) ;
741
727
assert ! ( pruning_stats. contained( & column_a, & values) . is_none( ) ) ;
742
728
}
743
729
744
730
#[ test]
745
731
fn test_composite_pruning_statistics_partition_and_file ( ) {
746
732
// Create partition statistics
747
733
let partition_values = vec ! [
748
- vec![ ScalarValue :: Int32 ( Some ( 1 ) ) , ScalarValue :: Int32 ( Some ( 10 ) ) ] ,
749
- vec![ ScalarValue :: Int32 ( Some ( 2 ) ) , ScalarValue :: Int32 ( Some ( 20 ) ) ] ,
734
+ vec![ ScalarValue :: from ( 1i32 ) , ScalarValue :: from ( 10i32 ) ] ,
735
+ vec![ ScalarValue :: from ( 2i32 ) , ScalarValue :: from ( 20i32 ) ] ,
750
736
] ;
751
737
let partition_fields = vec ! [
752
738
Arc :: new( Field :: new( "part_a" , DataType :: Int32 , false ) ) ,
@@ -761,22 +747,14 @@ mod tests {
761
747
Statistics :: default ( )
762
748
. add_column_statistics(
763
749
ColumnStatistics :: new_unknown( )
764
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
765
- 100 ,
766
- ) ) ) )
767
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
768
- 200 ,
769
- ) ) ) )
750
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 100i32 ) ) )
751
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 200i32 ) ) )
770
752
. with_null_count( Precision :: Exact ( 0 ) ) ,
771
753
)
772
754
. add_column_statistics(
773
755
ColumnStatistics :: new_unknown( )
774
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
775
- 300 ,
776
- ) ) ) )
777
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
778
- 400 ,
779
- ) ) ) )
756
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 300i32 ) ) )
757
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 400i32 ) ) )
780
758
. with_null_count( Precision :: Exact ( 5 ) ) ,
781
759
)
782
760
. with_num_rows( Precision :: Exact ( 100 ) ) ,
@@ -785,22 +763,14 @@ mod tests {
785
763
Statistics :: default ( )
786
764
. add_column_statistics(
787
765
ColumnStatistics :: new_unknown( )
788
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
789
- 500 ,
790
- ) ) ) )
791
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
792
- 600 ,
793
- ) ) ) )
766
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 500i32 ) ) )
767
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 600i32 ) ) )
794
768
. with_null_count( Precision :: Exact ( 10 ) ) ,
795
769
)
796
770
. add_column_statistics(
797
771
ColumnStatistics :: new_unknown( )
798
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
799
- 700 ,
800
- ) ) ) )
801
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
802
- 800 ,
803
- ) ) ) )
772
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 700i32 ) ) )
773
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 800i32 ) ) )
804
774
. with_null_count( Precision :: Exact ( 0 ) ) ,
805
775
)
806
776
. with_num_rows( Precision :: Exact ( 200 ) ) ,
@@ -900,7 +870,7 @@ mod tests {
900
870
assert_eq ! ( row_counts_col_x, expected_row_counts) ;
901
871
902
872
// Test contained values - only available from partition statistics
903
- let values = HashSet :: from ( [ ScalarValue :: Int32 ( Some ( 1 ) ) ] ) ;
873
+ let values = HashSet :: from ( [ ScalarValue :: from ( 1i32 ) ] ) ;
904
874
let contained_part_a = composite_stats. contained ( & part_a, & values) . unwrap ( ) ;
905
875
let expected_contained_part_a = BooleanArray :: from ( vec ! [ true , false ] ) ;
906
876
assert_eq ! ( contained_part_a, expected_contained_part_a) ;
@@ -931,12 +901,8 @@ mod tests {
931
901
Statistics :: default ( )
932
902
. add_column_statistics(
933
903
ColumnStatistics :: new_unknown( )
934
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
935
- 100 ,
936
- ) ) ) )
937
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
938
- 200 ,
939
- ) ) ) )
904
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 100i32 ) ) )
905
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 200i32 ) ) )
940
906
. with_null_count( Precision :: Exact ( 0 ) ) ,
941
907
)
942
908
. with_num_rows( Precision :: Exact ( 100 ) ) ,
@@ -945,12 +911,8 @@ mod tests {
945
911
Statistics :: default ( )
946
912
. add_column_statistics(
947
913
ColumnStatistics :: new_unknown( )
948
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
949
- 300 ,
950
- ) ) ) )
951
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
952
- 400 ,
953
- ) ) ) )
914
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 300i32 ) ) )
915
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 400i32 ) ) )
954
916
. with_null_count( Precision :: Exact ( 5 ) ) ,
955
917
)
956
918
. with_num_rows( Precision :: Exact ( 200 ) ) ,
@@ -970,12 +932,8 @@ mod tests {
970
932
Statistics :: default ( )
971
933
. add_column_statistics(
972
934
ColumnStatistics :: new_unknown( )
973
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
974
- 1000 ,
975
- ) ) ) )
976
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
977
- 2000 ,
978
- ) ) ) )
935
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 1000i32 ) ) )
936
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 2000i32 ) ) )
979
937
. with_null_count( Precision :: Exact ( 10 ) ) ,
980
938
)
981
939
. with_num_rows( Precision :: Exact ( 1000 ) ) ,
@@ -984,12 +942,8 @@ mod tests {
984
942
Statistics :: default ( )
985
943
. add_column_statistics(
986
944
ColumnStatistics :: new_unknown( )
987
- . with_min_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
988
- 3000 ,
989
- ) ) ) )
990
- . with_max_value( Precision :: Exact ( ScalarValue :: Int32 ( Some (
991
- 4000 ,
992
- ) ) ) )
945
+ . with_min_value( Precision :: Exact ( ScalarValue :: from( 3000i32 ) ) )
946
+ . with_max_value( Precision :: Exact ( ScalarValue :: from( 4000i32 ) ) )
993
947
. with_null_count( Precision :: Exact ( 20 ) ) ,
994
948
)
995
949
. with_num_rows( Precision :: Exact ( 2000 ) ) ,
@@ -1096,8 +1050,8 @@ mod tests {
1096
1050
// Create statistics with different number of containers
1097
1051
// Use partition stats for the test
1098
1052
let partition_values_1 = vec ! [
1099
- vec![ ScalarValue :: Int32 ( Some ( 1 ) ) , ScalarValue :: Int32 ( Some ( 10 ) ) ] ,
1100
- vec![ ScalarValue :: Int32 ( Some ( 2 ) ) , ScalarValue :: Int32 ( Some ( 20 ) ) ] ,
1053
+ vec![ ScalarValue :: from ( 1i32 ) , ScalarValue :: from ( 10i32 ) ] ,
1054
+ vec![ ScalarValue :: from ( 2i32 ) , ScalarValue :: from ( 20i32 ) ] ,
1101
1055
] ;
1102
1056
let partition_fields_1 = vec ! [
1103
1057
Arc :: new( Field :: new( "part_a" , DataType :: Int32 , false ) ) ,
@@ -1106,9 +1060,9 @@ mod tests {
1106
1060
let partition_stats_1 =
1107
1061
PartitionPruningStatistics :: new ( partition_values_1, partition_fields_1) ;
1108
1062
let partition_values_2 = vec ! [
1109
- vec![ ScalarValue :: Int32 ( Some ( 3 ) ) , ScalarValue :: Int32 ( Some ( 30 ) ) ] ,
1110
- vec![ ScalarValue :: Int32 ( Some ( 4 ) ) , ScalarValue :: Int32 ( Some ( 40 ) ) ] ,
1111
- vec![ ScalarValue :: Int32 ( Some ( 5 ) ) , ScalarValue :: Int32 ( Some ( 50 ) ) ] ,
1063
+ vec![ ScalarValue :: from ( 3i32 ) , ScalarValue :: from ( 30i32 ) ] ,
1064
+ vec![ ScalarValue :: from ( 4i32 ) , ScalarValue :: from ( 40i32 ) ] ,
1065
+ vec![ ScalarValue :: from ( 5i32 ) , ScalarValue :: from ( 50i32 ) ] ,
1112
1066
] ;
1113
1067
let partition_fields_2 = vec ! [
1114
1068
Arc :: new( Field :: new( "part_x" , DataType :: Int32 , false ) ) ,
0 commit comments