Jefffrey commented on code in PR #12304:
URL: https://github.com/apache/arrow-rs/pull/12304#discussion_r4624722548
##########
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:
is reserve strictly necessary here? is there a performance reason for this
inclusion?
##########
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))
Review Comment:
i feel these maps can be combined
##########
parquet_derive/src/parquet_field.rs:
##########
@@ -68,17 +68,21 @@ impl Field {
///
/// Can only generate writers for basic structs, for example:
///
+ /// ```ignore
Review Comment:
does this need to be `ignore`? similarly for below
--
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]