@@ -425,7 +425,7 @@ impl ExecutionPlan for CsvExec {
425425/// let file_scan_config = FileScanConfig::new(object_store_url, file_schema, source)
426426/// .with_file(PartitionedFile::new("file1.csv", 100*1024*1024))
427427/// .with_newlines_in_values(true); // The file contains newlines in values;
428- /// let exec = file_scan_config.new_exec ();
428+ /// let exec = file_scan_config.build ();
429429/// ```
430430#[ derive( Debug , Clone , Default ) ]
431431pub struct CsvSource {
@@ -836,14 +836,14 @@ mod tests {
836836 ) ?;
837837
838838 let source = Arc :: new ( CsvSource :: new ( true , b',' , b'"' ) ) ;
839- let mut config = partitioned_csv_config ( file_schema, file_groups, source)
839+ let config = partitioned_csv_config ( file_schema, file_groups, source)
840840 . with_file_compression_type ( file_compression_type)
841- . with_newlines_in_values ( false ) ;
842- config. projection = Some ( vec ! [ 0 , 2 , 4 ] ) ;
843-
844- let csv = config. new_exec ( ) ;
841+ . with_newlines_in_values ( false )
842+ . with_projection ( Some ( vec ! [ 0 , 2 , 4 ] ) ) ;
845843
846844 assert_eq ! ( 13 , config. file_schema. fields( ) . len( ) ) ;
845+ let csv = config. build ( ) ;
846+
847847 assert_eq ! ( 3 , csv. schema( ) . fields( ) . len( ) ) ;
848848
849849 let mut stream = csv. execute ( 0 , task_ctx) ?;
@@ -901,12 +901,12 @@ mod tests {
901901 ) ?;
902902
903903 let source = Arc :: new ( CsvSource :: new ( true , b',' , b'"' ) ) ;
904- let mut config = partitioned_csv_config ( file_schema, file_groups, source)
904+ let config = partitioned_csv_config ( file_schema, file_groups, source)
905905 . with_newlines_in_values ( false )
906- . with_file_compression_type ( file_compression_type. to_owned ( ) ) ;
907- config. projection = Some ( vec ! [ 4 , 0 , 2 ] ) ;
908- let csv = config. new_exec ( ) ;
906+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
907+ . with_projection ( Some ( vec ! [ 4 , 0 , 2 ] ) ) ;
909908 assert_eq ! ( 13 , config. file_schema. fields( ) . len( ) ) ;
909+ let csv = config. build ( ) ;
910910 assert_eq ! ( 3 , csv. schema( ) . fields( ) . len( ) ) ;
911911
912912 let mut stream = csv. execute ( 0 , task_ctx) ?;
@@ -964,12 +964,12 @@ mod tests {
964964 ) ?;
965965
966966 let source = Arc :: new ( CsvSource :: new ( true , b',' , b'"' ) ) ;
967- let mut config = partitioned_csv_config ( file_schema, file_groups, source)
967+ let config = partitioned_csv_config ( file_schema, file_groups, source)
968968 . with_newlines_in_values ( false )
969- . with_file_compression_type ( file_compression_type. to_owned ( ) ) ;
970- config. limit = Some ( 5 ) ;
971- let csv = config. new_exec ( ) ;
969+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
970+ . with_limit ( Some ( 5 ) ) ;
972971 assert_eq ! ( 13 , config. file_schema. fields( ) . len( ) ) ;
972+ let csv = config. build ( ) ;
973973 assert_eq ! ( 13 , csv. schema( ) . fields( ) . len( ) ) ;
974974
975975 let mut it = csv. execute ( 0 , task_ctx) ?;
@@ -1024,12 +1024,12 @@ mod tests {
10241024 ) ?;
10251025
10261026 let source = Arc :: new ( CsvSource :: new ( true , b',' , b'"' ) ) ;
1027- let mut config = partitioned_csv_config ( file_schema, file_groups, source)
1027+ let config = partitioned_csv_config ( file_schema, file_groups, source)
10281028 . with_newlines_in_values ( false )
1029- . with_file_compression_type ( file_compression_type. to_owned ( ) ) ;
1030- config. limit = Some ( 5 ) ;
1031- let csv = config. new_exec ( ) ;
1029+ . with_file_compression_type ( file_compression_type. to_owned ( ) )
1030+ . with_limit ( Some ( 5 ) ) ;
10321031 assert_eq ! ( 14 , config. file_schema. fields( ) . len( ) ) ;
1032+ let csv = config. build ( ) ;
10331033 assert_eq ! ( 14 , csv. schema( ) . fields( ) . len( ) ) ;
10341034
10351035 // errors due to https://github.com/apache/datafusion/issues/4918
@@ -1089,8 +1089,8 @@ mod tests {
10891089 // we don't have `/date=xx/` in the path but that is ok because
10901090 // partitions are resolved during scan anyway
10911091
1092- let csv = config. new_exec ( ) ;
10931092 assert_eq ! ( 13 , config. file_schema. fields( ) . len( ) ) ;
1093+ let csv = config. build ( ) ;
10941094 assert_eq ! ( 2 , csv. schema( ) . fields( ) . len( ) ) ;
10951095
10961096 let mut it = csv. execute ( 0 , task_ctx) ?;
@@ -1179,7 +1179,7 @@ mod tests {
11791179 let config = partitioned_csv_config ( file_schema, file_groups, source)
11801180 . with_newlines_in_values ( false )
11811181 . with_file_compression_type ( file_compression_type. to_owned ( ) ) ;
1182- let csv = config. new_exec ( ) ;
1182+ let csv = config. build ( ) ;
11831183
11841184 let it = csv. execute ( 0 , task_ctx) . unwrap ( ) ;
11851185 let batches: Vec < _ > = it. try_collect ( ) . await . unwrap ( ) ;
0 commit comments