@@ -123,15 +123,12 @@ mod tests {
123123 let table_schema = TableSchema :: from_file_schema ( Arc :: clone ( & file_schema) ) ;
124124 let source =
125125 Arc :: new ( CsvSource :: new ( table_schema. clone ( ) ) . with_csv_options ( options) ) ;
126- let config = FileScanConfigBuilder :: from ( partitioned_csv_config (
127- table_schema,
128- file_groups,
129- source,
130- ) )
131- . with_file_compression_type ( file_compression_type)
132- . with_newlines_in_values ( false )
133- . with_projection_indices ( Some ( vec ! [ 0 , 2 , 4 ] ) )
134- . build ( ) ;
126+ let config =
127+ FileScanConfigBuilder :: from ( partitioned_csv_config ( file_groups, source) )
128+ . with_file_compression_type ( file_compression_type)
129+ . with_newlines_in_values ( false )
130+ . with_projection_indices ( Some ( vec ! [ 0 , 2 , 4 ] ) )
131+ . build ( ) ;
135132
136133 assert_eq ! ( 13 , config. file_schema( ) . fields( ) . len( ) ) ;
137134 let csv = DataSourceExec :: from_data_source ( config) ;
@@ -198,15 +195,12 @@ mod tests {
198195 let table_schema = TableSchema :: from_file_schema ( Arc :: clone ( & file_schema) ) ;
199196 let source =
200197 Arc :: new ( CsvSource :: new ( table_schema. clone ( ) ) . with_csv_options ( options) ) ;
201- let config = FileScanConfigBuilder :: from ( partitioned_csv_config (
202- table_schema,
203- file_groups,
204- source,
205- ) )
206- . with_newlines_in_values ( false )
207- . with_file_compression_type ( file_compression_type. to_owned ( ) )
208- . with_projection_indices ( Some ( vec ! [ 4 , 0 , 2 ] ) )
209- . build ( ) ;
198+ let config =
199+ FileScanConfigBuilder :: from ( partitioned_csv_config ( file_groups, source) )
200+ . with_newlines_in_values ( false )
201+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
202+ . with_projection_indices ( Some ( vec ! [ 4 , 0 , 2 ] ) )
203+ . build ( ) ;
210204 assert_eq ! ( 13 , config. file_schema( ) . fields( ) . len( ) ) ;
211205 let csv = DataSourceExec :: from_data_source ( config) ;
212206 assert_eq ! ( 3 , csv. schema( ) . fields( ) . len( ) ) ;
@@ -272,15 +266,12 @@ mod tests {
272266 let table_schema = TableSchema :: from_file_schema ( Arc :: clone ( & file_schema) ) ;
273267 let source =
274268 Arc :: new ( CsvSource :: new ( table_schema. clone ( ) ) . with_csv_options ( options) ) ;
275- let config = FileScanConfigBuilder :: from ( partitioned_csv_config (
276- table_schema,
277- file_groups,
278- source,
279- ) )
280- . with_newlines_in_values ( false )
281- . with_file_compression_type ( file_compression_type. to_owned ( ) )
282- . with_limit ( Some ( 5 ) )
283- . build ( ) ;
269+ let config =
270+ FileScanConfigBuilder :: from ( partitioned_csv_config ( file_groups, source) )
271+ . with_newlines_in_values ( false )
272+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
273+ . with_limit ( Some ( 5 ) )
274+ . build ( ) ;
284275 assert_eq ! ( 13 , config. file_schema( ) . fields( ) . len( ) ) ;
285276 let csv = DataSourceExec :: from_data_source ( config) ;
286277 assert_eq ! ( 13 , csv. schema( ) . fields( ) . len( ) ) ;
@@ -345,15 +336,12 @@ mod tests {
345336 let table_schema = TableSchema :: from_file_schema ( Arc :: clone ( & file_schema) ) ;
346337 let source =
347338 Arc :: new ( CsvSource :: new ( table_schema. clone ( ) ) . with_csv_options ( options) ) ;
348- let config = FileScanConfigBuilder :: from ( partitioned_csv_config (
349- table_schema,
350- file_groups,
351- source,
352- ) )
353- . with_newlines_in_values ( false )
354- . with_file_compression_type ( file_compression_type. to_owned ( ) )
355- . with_limit ( Some ( 5 ) )
356- . build ( ) ;
339+ let config =
340+ FileScanConfigBuilder :: from ( partitioned_csv_config ( file_groups, source) )
341+ . with_newlines_in_values ( false )
342+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
343+ . with_limit ( Some ( 5 ) )
344+ . build ( ) ;
357345 assert_eq ! ( 14 , config. file_schema( ) . fields( ) . len( ) ) ;
358346 let csv = DataSourceExec :: from_data_source ( config) ;
359347 assert_eq ! ( 14 , csv. schema( ) . fields( ) . len( ) ) ;
@@ -410,23 +398,20 @@ mod tests {
410398 quote : b'"' ,
411399 ..Default :: default ( )
412400 } ;
413- let source =
414- Arc :: new ( CsvSource :: new ( Arc :: clone ( & file_schema) ) . with_csv_options ( options) ) ;
415401 let table_schema = TableSchema :: new (
416402 Arc :: clone ( & file_schema) ,
417403 vec ! [ Arc :: new( Field :: new( "date" , DataType :: Utf8 , false ) ) ] ,
418404 ) ;
419- let config = FileScanConfigBuilder :: from ( partitioned_csv_config (
420- table_schema,
421- file_groups,
422- source,
423- ) )
424- . with_newlines_in_values ( false )
425- . with_file_compression_type ( file_compression_type. to_owned ( ) )
426- // We should be able to project on the partition column
427- // Which is supposed to be after the file fields
428- . with_projection_indices ( Some ( vec ! [ 0 , num_file_schema_fields] ) )
429- . build ( ) ;
405+ let source =
406+ Arc :: new ( CsvSource :: new ( table_schema. clone ( ) ) . with_csv_options ( options) ) ;
407+ let config =
408+ FileScanConfigBuilder :: from ( partitioned_csv_config ( file_groups, source) )
409+ . with_newlines_in_values ( false )
410+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
411+ // We should be able to project on the partition column
412+ // Which is supposed to be after the file fields
413+ . with_projection_indices ( Some ( vec ! [ 0 , num_file_schema_fields] ) )
414+ . build ( ) ;
430415
431416 // we don't have `/date=xx/` in the path but that is ok because
432417 // partitions are resolved during scan anyway
@@ -524,14 +509,11 @@ mod tests {
524509 let table_schema = TableSchema :: from_file_schema ( Arc :: clone ( & file_schema) ) ;
525510 let source =
526511 Arc :: new ( CsvSource :: new ( table_schema. clone ( ) ) . with_csv_options ( options) ) ;
527- let config = FileScanConfigBuilder :: from ( partitioned_csv_config (
528- table_schema,
529- file_groups,
530- source,
531- ) )
532- . with_newlines_in_values ( false )
533- . with_file_compression_type ( file_compression_type. to_owned ( ) )
534- . build ( ) ;
512+ let config =
513+ FileScanConfigBuilder :: from ( partitioned_csv_config ( file_groups, source) )
514+ . with_newlines_in_values ( false )
515+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
516+ . build ( ) ;
535517 let csv = DataSourceExec :: from_data_source ( config) ;
536518
537519 let it = csv. execute ( 0 , task_ctx) . unwrap ( ) ;
0 commit comments