krtab commented on code in PR #12304:
URL: https://github.com/apache/arrow-rs/pull/12304#discussion_r4666674906
##########
parquet_derive/src/lib.rs:
##########
@@ -254,11 +254,16 @@ pub fn parquet_record_reader(input:
proc_macro::TokenStream) -> proc_macro::Toke
let mut row_group_reader = row_group_reader;
// key: parquet file column name, value: column index
- let mut name_to_index = std::collections::HashMap::new();
- for (idx, col) in
row_group_reader.metadata().schema_descr().columns().iter().enumerate() {
- name_to_index.insert(col.name().to_string(), idx);
- }
-
+ let name_to_index : std::collections::HashMap<_,_> = row_group_reader
+ .metadata()
+ .schema_descr()
+ .columns()
+ .iter()
+ .map(|col| col.name().to_string())
+ .enumerate()
+ .map(|(col,idx)| (idx,col))
+ .collect();
+ self.reserve(num_records);
Review Comment:
Done
--
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]