@@ -24,7 +24,7 @@ use datafusion::{
2424 file_format:: file_compression_type:: FileCompressionType ,
2525 listing:: PartitionedFile ,
2626 object_store:: ObjectStoreUrl ,
27- physical_plan:: { CsvSource , FileSource , FileStream , JsonOpener , JsonSource } ,
27+ physical_plan:: { CsvSource , FileSource , FileStream , JsonOpener } ,
2828 } ,
2929 error:: Result ,
3030 physical_plan:: metrics:: ExecutionPlanMetricsSet ,
@@ -58,17 +58,17 @@ async fn csv_opener() -> Result<()> {
5858 let scan_config = FileScanConfigBuilder :: new (
5959 ObjectStoreUrl :: local_filesystem ( ) ,
6060 Arc :: clone ( & schema) ,
61- Arc :: new ( CsvSource :: default ( ) ) ,
6261 )
6362 . with_projection ( Some ( vec ! [ 12 , 0 ] ) )
6463 . with_batch_size ( Some ( 8192 ) )
6564 . with_limit ( Some ( 5 ) )
6665 . with_file ( PartitionedFile :: new ( path. display ( ) . to_string ( ) , 10 ) )
6766 . build ( ) ;
6867
69- let config = CsvSource :: new ( true , b',' , b'"' ) . with_comment ( Some ( b'#' ) ) ;
68+ let source =
69+ CsvSource :: new ( true , b',' , b'"' , scan_config. clone ( ) ) . with_comment ( Some ( b'#' ) ) ;
7070
71- let opener = config . create_file_opener ( object_store, & scan_config , 0 ) ;
71+ let opener = source . create_file_opener ( object_store, 0 ) ;
7272
7373 let mut result = vec ! [ ] ;
7474 let mut stream =
@@ -118,15 +118,12 @@ async fn json_opener() -> Result<()> {
118118 Arc :: new ( object_store) ,
119119 ) ;
120120
121- let scan_config = FileScanConfigBuilder :: new (
122- ObjectStoreUrl :: local_filesystem ( ) ,
123- schema,
124- Arc :: new ( JsonSource :: default ( ) ) ,
125- )
126- . with_projection ( Some ( vec ! [ 1 , 0 ] ) )
127- . with_limit ( Some ( 5 ) )
128- . with_file ( PartitionedFile :: new ( path. to_string ( ) , 10 ) )
129- . build ( ) ;
121+ let scan_config =
122+ FileScanConfigBuilder :: new ( ObjectStoreUrl :: local_filesystem ( ) , schema)
123+ . with_projection ( Some ( vec ! [ 1 , 0 ] ) )
124+ . with_limit ( Some ( 5 ) )
125+ . with_file ( PartitionedFile :: new ( path. to_string ( ) , 10 ) )
126+ . build ( ) ;
130127
131128 let mut stream = FileStream :: new (
132129 & scan_config,
0 commit comments