@@ -876,7 +876,7 @@ mod test {
876876
877877 // A filter on "a" should not exclude any rows even if it matches the data
878878 let expr = col ( "a" ) . eq ( lit ( 1 ) ) ;
879- let predicate = logical2physical ( & expr, & schema) ;
879+ let predicate = logical2physical ( & expr, Arc :: clone ( & schema) ) ;
880880 let opener = make_opener ( predicate) ;
881881 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
882882 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -885,7 +885,7 @@ mod test {
885885
886886 // A filter on `b = 5.0` should exclude all rows
887887 let expr = col ( "b" ) . eq ( lit ( ScalarValue :: Float32 ( Some ( 5.0 ) ) ) ) ;
888- let predicate = logical2physical ( & expr, & schema) ;
888+ let predicate = logical2physical ( & expr, Arc :: clone ( & schema) ) ;
889889 let opener = make_opener ( predicate) ;
890890 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
891891 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -951,7 +951,8 @@ mod test {
951951 let expr = col ( "part" ) . eq ( lit ( 1 ) ) ;
952952 // Mark the expression as dynamic even if it's not to force partition pruning to happen
953953 // Otherwise we assume it already happened at the planning stage and won't re-do the work here
954- let predicate = make_dynamic_expr ( logical2physical ( & expr, & table_schema) ) ;
954+ let predicate =
955+ make_dynamic_expr ( logical2physical ( & expr, Arc :: clone ( & table_schema) ) ) ;
955956 let opener = make_opener ( predicate) ;
956957 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
957958 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -962,7 +963,7 @@ mod test {
962963 let expr = col ( "part" ) . eq ( lit ( 2 ) ) ;
963964 // Mark the expression as dynamic even if it's not to force partition pruning to happen
964965 // Otherwise we assume it already happened at the planning stage and won't re-do the work here
965- let predicate = make_dynamic_expr ( logical2physical ( & expr, & table_schema) ) ;
966+ let predicate = make_dynamic_expr ( logical2physical ( & expr, table_schema) ) ;
966967 let opener = make_opener ( predicate) ;
967968 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
968969 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1038,7 +1039,7 @@ mod test {
10381039
10391040 // Filter should match the partition value and file statistics
10401041 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . and ( col ( "b" ) . eq ( lit ( 1.0 ) ) ) ;
1041- let predicate = logical2physical ( & expr, & table_schema) ;
1042+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
10421043 let opener = make_opener ( predicate) ;
10431044 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
10441045 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1047,7 +1048,7 @@ mod test {
10471048
10481049 // Should prune based on partition value but not file statistics
10491050 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . and ( col ( "b" ) . eq ( lit ( 1.0 ) ) ) ;
1050- let predicate = logical2physical ( & expr, & table_schema) ;
1051+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
10511052 let opener = make_opener ( predicate) ;
10521053 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
10531054 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1056,7 +1057,7 @@ mod test {
10561057
10571058 // Should prune based on file statistics but not partition value
10581059 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . and ( col ( "b" ) . eq ( lit ( 7.0 ) ) ) ;
1059- let predicate = logical2physical ( & expr, & table_schema) ;
1060+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
10601061 let opener = make_opener ( predicate) ;
10611062 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
10621063 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1065,7 +1066,7 @@ mod test {
10651066
10661067 // Should prune based on both partition value and file statistics
10671068 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . and ( col ( "b" ) . eq ( lit ( 7.0 ) ) ) ;
1068- let predicate = logical2physical ( & expr, & table_schema) ;
1069+ let predicate = logical2physical ( & expr, table_schema) ;
10691070 let opener = make_opener ( predicate) ;
10701071 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
10711072 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1130,7 +1131,7 @@ mod test {
11301131
11311132 // Filter should match the partition value and data value
11321133 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . or ( col ( "a" ) . eq ( lit ( 1 ) ) ) ;
1133- let predicate = logical2physical ( & expr, & table_schema) ;
1134+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
11341135 let opener = make_opener ( predicate) ;
11351136 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
11361137 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1139,7 +1140,7 @@ mod test {
11391140
11401141 // Filter should match the partition value but not the data value
11411142 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . or ( col ( "a" ) . eq ( lit ( 3 ) ) ) ;
1142- let predicate = logical2physical ( & expr, & table_schema) ;
1143+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
11431144 let opener = make_opener ( predicate) ;
11441145 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
11451146 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1148,7 +1149,7 @@ mod test {
11481149
11491150 // Filter should not match the partition value but match the data value
11501151 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . or ( col ( "a" ) . eq ( lit ( 1 ) ) ) ;
1151- let predicate = logical2physical ( & expr, & table_schema) ;
1152+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
11521153 let opener = make_opener ( predicate) ;
11531154 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
11541155 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1157,7 +1158,7 @@ mod test {
11571158
11581159 // Filter should not match the partition value or the data value
11591160 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . or ( col ( "a" ) . eq ( lit ( 3 ) ) ) ;
1160- let predicate = logical2physical ( & expr, & table_schema) ;
1161+ let predicate = logical2physical ( & expr, table_schema) ;
11611162 let opener = make_opener ( predicate) ;
11621163 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
11631164 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1222,15 +1223,15 @@ mod test {
12221223
12231224 // Filter should NOT match the stats but the file is never attempted to be pruned because the filters are not dynamic
12241225 let expr = col ( "part" ) . eq ( lit ( 2 ) ) ;
1225- let predicate = logical2physical ( & expr, & table_schema) ;
1226+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
12261227 let opener = make_opener ( predicate) ;
12271228 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
12281229 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
12291230 assert_eq ! ( num_batches, 1 ) ;
12301231 assert_eq ! ( num_rows, 3 ) ;
12311232
12321233 // If we make the filter dynamic, it should prune
1233- let predicate = make_dynamic_expr ( logical2physical ( & expr, & table_schema) ) ;
1234+ let predicate = make_dynamic_expr ( logical2physical ( & expr, table_schema) ) ;
12341235 let opener = make_opener ( predicate) ;
12351236 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
12361237 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1369,7 +1370,8 @@ mod test {
13691370 max_predicate_cache_size : None ,
13701371 } ;
13711372
1372- let predicate = logical2physical ( & col ( "a" ) . eq ( lit ( 1u64 ) ) , & table_schema) ;
1373+ let predicate =
1374+ logical2physical ( & col ( "a" ) . eq ( lit ( 1u64 ) ) , Arc :: clone ( & table_schema) ) ;
13731375 let opener = make_opener ( predicate) ;
13741376 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
13751377 let batches = collect_batches ( stream) . await ;
0 commit comments