@@ -24,7 +24,7 @@ use datafusion::{
24
24
file_format:: file_compression_type:: FileCompressionType ,
25
25
listing:: PartitionedFile ,
26
26
object_store:: ObjectStoreUrl ,
27
- physical_plan:: { CsvSource , FileSource , FileStream , JsonOpener , JsonSource } ,
27
+ physical_plan:: { CsvSource , FileSource , FileStream , JsonOpener } ,
28
28
} ,
29
29
error:: Result ,
30
30
physical_plan:: metrics:: ExecutionPlanMetricsSet ,
@@ -58,17 +58,17 @@ async fn csv_opener() -> Result<()> {
58
58
let scan_config = FileScanConfigBuilder :: new (
59
59
ObjectStoreUrl :: local_filesystem ( ) ,
60
60
Arc :: clone ( & schema) ,
61
- Arc :: new ( CsvSource :: default ( ) ) ,
62
61
)
63
62
. with_projection ( Some ( vec ! [ 12 , 0 ] ) )
64
63
. with_batch_size ( Some ( 8192 ) )
65
64
. with_limit ( Some ( 5 ) )
66
65
. with_file ( PartitionedFile :: new ( path. display ( ) . to_string ( ) , 10 ) )
67
66
. build ( ) ;
68
67
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'#' ) ) ;
70
70
71
- let opener = config . create_file_opener ( object_store, & scan_config , 0 ) ;
71
+ let opener = source . create_file_opener ( object_store, 0 ) ;
72
72
73
73
let mut result = vec ! [ ] ;
74
74
let mut stream =
@@ -118,15 +118,12 @@ async fn json_opener() -> Result<()> {
118
118
Arc :: new ( object_store) ,
119
119
) ;
120
120
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 ( ) ;
130
127
131
128
let mut stream = FileStream :: new (
132
129
& scan_config,
0 commit comments