alamb commented on code in PR #6629:
URL: https://github.com/apache/arrow-datafusion/pull/6629#discussion_r1422414855
##########
datafusion/core/src/datasource/file_format/parquet.rs:
##########
@@ -176,13 +186,26 @@ impl FileFormat for ParquetFormat {
store: &Arc<dyn ObjectStore>,
objects: &[ObjectMeta],
) -> Result<SchemaRef> {
- let schemas: Vec<_> = futures::stream::iter(objects)
- .map(|object| fetch_schema(store.as_ref(), object,
self.metadata_size_hint))
+ let mut schemas: Vec<_> = futures::stream::iter(objects)
+ .map(|object| {
+ fetch_schema_with_location(
+ store.as_ref(),
+ object,
+ self.metadata_size_hint,
+ )
+ })
.boxed() // Workaround
https://github.com/rust-lang/rust/issues/64552
.buffered(state.config_options().execution.meta_fetch_concurrency)
.try_collect()
.await?;
+ schemas.sort_by(|(location1, _), (location2, _)|
location1.cmp(location2));
Review Comment:
```suggestion
// Schema inference adds fields based the order they are seen
// which depends on the order the files are processed. For some
// object stores (like local file systems) the order returned from
list
// is not deterministic. Thus, to ensure deterministic schema
inference
// sort the files first.
// https://github.com/apache/arrow-datafusion/pull/6629
schemas.sort_by(|(location1, _), (location2, _)|
location1.cmp(location2));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]