Dandandan commented on code in PR #20462:
URL: https://github.com/apache/datafusion/pull/20462#discussion_r2836286224
##########
datafusion/datasource-parquet/src/file_format.rs:
##########
@@ -401,12 +401,10 @@ impl FileFormat for ParquetFormat {
// is not deterministic. Thus, to ensure deterministic schema inference
// sort the files first.
// https://github.com/apache/datafusion/pull/6629
- schemas.sort_by(|(location1, _), (location2, _)|
location1.cmp(location2));
+ schemas
Review Comment:
Remove allocation during sort
##########
datafusion/datasource-parquet/src/file_format.rs:
##########
@@ -401,12 +401,10 @@ impl FileFormat for ParquetFormat {
// is not deterministic. Thus, to ensure deterministic schema inference
// sort the files first.
// https://github.com/apache/datafusion/pull/6629
- schemas.sort_by(|(location1, _), (location2, _)|
location1.cmp(location2));
+ schemas
+ .sort_unstable_by(|(location1, _), (location2, _)|
location1.cmp(location2));
- let schemas = schemas
- .into_iter()
- .map(|(_, schema)| schema)
- .collect::<Vec<_>>();
+ let schemas = schemas.into_iter().map(|(_, schema)| schema);
Review Comment:
Remove one more allocation
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]