File tree Expand file tree Collapse file tree 1 file changed +18
-1
lines changed
datafusion/src/datasource/listing Expand file tree Collapse file tree 1 file changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ impl ListingOptions {
7676 file_extension : String :: new ( ) ,
7777 format,
7878 table_partition_cols : vec ! [ ] ,
79- collect_stat : false ,
79+ collect_stat : true ,
8080 target_partitions : 1 ,
8181 }
8282 }
@@ -303,6 +303,23 @@ mod tests {
303303 Ok ( ( ) )
304304 }
305305
306+ #[ tokio:: test]
307+ async fn load_table_stats_by_default ( ) -> Result < ( ) > {
308+ let testdata = crate :: test_util:: parquet_test_data ( ) ;
309+ let filename = format ! ( "{}/{}" , testdata, "alltypes_plain.parquet" ) ;
310+ let opt = ListingOptions :: new ( Arc :: new ( ParquetFormat :: default ( ) ) ) ;
311+ let schema = opt
312+ . infer_schema ( Arc :: new ( LocalFileSystem { } ) , & filename)
313+ . await ?;
314+ let table =
315+ ListingTable :: new ( Arc :: new ( LocalFileSystem { } ) , filename, schema, opt) ;
316+ let exec = table. scan ( & None , 1024 , & [ ] , None ) . await ?;
317+ assert_eq ! ( exec. statistics( ) . num_rows, Some ( 8 ) ) ;
318+ assert_eq ! ( exec. statistics( ) . total_byte_size, Some ( 671 ) ) ;
319+
320+ Ok ( ( ) )
321+ }
322+
306323 #[ tokio:: test]
307324 async fn read_empty_table ( ) -> Result < ( ) > {
308325 let store = TestObjectStore :: new_arc ( & [ ( "table/p1=v1/file.avro" , 100 ) ] ) ;
You can’t perform that action at this time.
0 commit comments