@@ -903,7 +903,7 @@ mod test {
903903
904904 // A filter on "a" should not exclude any rows even if it matches the data
905905 let expr = col ( "a" ) . eq ( lit ( 1 ) ) ;
906- let predicate = logical2physical ( & expr, & schema) ;
906+ let predicate = logical2physical ( & expr, Arc :: clone ( & schema) ) ;
907907 let opener = make_opener ( predicate) ;
908908 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
909909 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -912,7 +912,7 @@ mod test {
912912
913913 // A filter on `b = 5.0` should exclude all rows
914914 let expr = col ( "b" ) . eq ( lit ( ScalarValue :: Float32 ( Some ( 5.0 ) ) ) ) ;
915- let predicate = logical2physical ( & expr, & schema) ;
915+ let predicate = logical2physical ( & expr, Arc :: clone ( & schema) ) ;
916916 let opener = make_opener ( predicate) ;
917917 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
918918 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -978,7 +978,8 @@ mod test {
978978 let expr = col ( "part" ) . eq ( lit ( 1 ) ) ;
979979 // Mark the expression as dynamic even if it's not to force partition pruning to happen
980980 // Otherwise we assume it already happened at the planning stage and won't re-do the work here
981- let predicate = make_dynamic_expr ( logical2physical ( & expr, & table_schema) ) ;
981+ let predicate =
982+ make_dynamic_expr ( logical2physical ( & expr, Arc :: clone ( & table_schema) ) ) ;
982983 let opener = make_opener ( predicate) ;
983984 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
984985 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -989,7 +990,7 @@ mod test {
989990 let expr = col ( "part" ) . eq ( lit ( 2 ) ) ;
990991 // Mark the expression as dynamic even if it's not to force partition pruning to happen
991992 // Otherwise we assume it already happened at the planning stage and won't re-do the work here
992- let predicate = make_dynamic_expr ( logical2physical ( & expr, & table_schema) ) ;
993+ let predicate = make_dynamic_expr ( logical2physical ( & expr, table_schema) ) ;
993994 let opener = make_opener ( predicate) ;
994995 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
995996 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1065,7 +1066,7 @@ mod test {
10651066
10661067 // Filter should match the partition value and file statistics
10671068 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . and ( col ( "b" ) . eq ( lit ( 1.0 ) ) ) ;
1068- let predicate = logical2physical ( & expr, & table_schema) ;
1069+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
10691070 let opener = make_opener ( predicate) ;
10701071 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
10711072 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1074,7 +1075,7 @@ mod test {
10741075
10751076 // Should prune based on partition value but not file statistics
10761077 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . and ( col ( "b" ) . eq ( lit ( 1.0 ) ) ) ;
1077- let predicate = logical2physical ( & expr, & table_schema) ;
1078+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
10781079 let opener = make_opener ( predicate) ;
10791080 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
10801081 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1083,7 +1084,7 @@ mod test {
10831084
10841085 // Should prune based on file statistics but not partition value
10851086 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . and ( col ( "b" ) . eq ( lit ( 7.0 ) ) ) ;
1086- let predicate = logical2physical ( & expr, & table_schema) ;
1087+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
10871088 let opener = make_opener ( predicate) ;
10881089 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
10891090 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1092,7 +1093,7 @@ mod test {
10921093
10931094 // Should prune based on both partition value and file statistics
10941095 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . and ( col ( "b" ) . eq ( lit ( 7.0 ) ) ) ;
1095- let predicate = logical2physical ( & expr, & table_schema) ;
1096+ let predicate = logical2physical ( & expr, table_schema) ;
10961097 let opener = make_opener ( predicate) ;
10971098 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
10981099 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1157,7 +1158,7 @@ mod test {
11571158
11581159 // Filter should match the partition value and data value
11591160 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . or ( col ( "a" ) . eq ( lit ( 1 ) ) ) ;
1160- let predicate = logical2physical ( & expr, & table_schema) ;
1161+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
11611162 let opener = make_opener ( predicate) ;
11621163 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
11631164 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1166,7 +1167,7 @@ mod test {
11661167
11671168 // Filter should match the partition value but not the data value
11681169 let expr = col ( "part" ) . eq ( lit ( 1 ) ) . or ( col ( "a" ) . eq ( lit ( 3 ) ) ) ;
1169- let predicate = logical2physical ( & expr, & table_schema) ;
1170+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
11701171 let opener = make_opener ( predicate) ;
11711172 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
11721173 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1175,7 +1176,7 @@ mod test {
11751176
11761177 // Filter should not match the partition value but match the data value
11771178 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . or ( col ( "a" ) . eq ( lit ( 1 ) ) ) ;
1178- let predicate = logical2physical ( & expr, & table_schema) ;
1179+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
11791180 let opener = make_opener ( predicate) ;
11801181 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
11811182 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1184,7 +1185,7 @@ mod test {
11841185
11851186 // Filter should not match the partition value or the data value
11861187 let expr = col ( "part" ) . eq ( lit ( 2 ) ) . or ( col ( "a" ) . eq ( lit ( 3 ) ) ) ;
1187- let predicate = logical2physical ( & expr, & table_schema) ;
1188+ let predicate = logical2physical ( & expr, table_schema) ;
11881189 let opener = make_opener ( predicate) ;
11891190 let stream = opener. open ( file) . unwrap ( ) . await . unwrap ( ) ;
11901191 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1249,15 +1250,15 @@ mod test {
12491250
12501251 // Filter should NOT match the stats but the file is never attempted to be pruned because the filters are not dynamic
12511252 let expr = col ( "part" ) . eq ( lit ( 2 ) ) ;
1252- let predicate = logical2physical ( & expr, & table_schema) ;
1253+ let predicate = logical2physical ( & expr, Arc :: clone ( & table_schema) ) ;
12531254 let opener = make_opener ( predicate) ;
12541255 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
12551256 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
12561257 assert_eq ! ( num_batches, 1 ) ;
12571258 assert_eq ! ( num_rows, 3 ) ;
12581259
12591260 // If we make the filter dynamic, it should prune
1260- let predicate = make_dynamic_expr ( logical2physical ( & expr, & table_schema) ) ;
1261+ let predicate = make_dynamic_expr ( logical2physical ( & expr, table_schema) ) ;
12611262 let opener = make_opener ( predicate) ;
12621263 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
12631264 let ( num_batches, num_rows) = count_batches_and_rows ( stream) . await ;
@@ -1396,7 +1397,8 @@ mod test {
13961397 max_predicate_cache_size : None ,
13971398 } ;
13981399
1399- let predicate = logical2physical ( & col ( "a" ) . eq ( lit ( 1u64 ) ) , & table_schema) ;
1400+ let predicate =
1401+ logical2physical ( & col ( "a" ) . eq ( lit ( 1u64 ) ) , Arc :: clone ( & table_schema) ) ;
14001402 let opener = make_opener ( predicate) ;
14011403 let stream = opener. open ( file. clone ( ) ) . unwrap ( ) . await . unwrap ( ) ;
14021404 let batches = collect_batches ( stream) . await ;
0 commit comments