File tree 1 file changed +7
-6
lines changed
datafusion/core/src/datasource/file_format 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ use async_trait::async_trait;
26
26
use bytes:: { BufMut , BytesMut } ;
27
27
use datafusion_common:: DataFusionError ;
28
28
use datafusion_physical_expr:: PhysicalExpr ;
29
+ use futures:: { StreamExt , TryStreamExt } ;
29
30
use hashbrown:: HashMap ;
30
31
use object_store:: { ObjectMeta , ObjectStore } ;
31
32
use parquet:: arrow:: parquet_to_arrow_schema;
@@ -151,12 +152,12 @@ impl FileFormat for ParquetFormat {
151
152
store : & Arc < dyn ObjectStore > ,
152
153
objects : & [ ObjectMeta ] ,
153
154
) -> Result < SchemaRef > {
154
- let mut schemas = Vec :: with_capacity ( objects. len ( ) ) ;
155
- for object in objects {
156
- let schema =
157
- fetch_schema ( store . as_ref ( ) , object , self . metadata_size_hint ) . await ? ;
158
- schemas . push ( schema )
159
- }
155
+ let schemas: Vec < _ > = futures :: stream :: iter ( objects)
156
+ . map ( | object| fetch_schema ( store . as_ref ( ) , object , self . metadata_size_hint ) )
157
+ . boxed ( ) // Workaround https://github.com/rust-lang/rust/issues/64552
158
+ . buffered ( 32 )
159
+ . try_collect ( )
160
+ . await ? ;
160
161
161
162
let schema = if self . skip_metadata ( state. config_options ( ) ) {
162
163
Schema :: try_merge ( clear_metadata ( schemas) )
You can’t perform that action at this time.
0 commit comments