kylebarron commented on code in PR #7365: URL: https://github.com/apache/arrow-rs/pull/7365#discussion_r2021852968
########## parquet/src/arrow/arrow_reader/statistics.rs: ########## @@ -1290,32 +1290,69 @@ impl<'a> StatisticsConverter<'a> { /// /// * If the column is not found in the arrow schema pub fn try_new<'b>( - column_name: &'b str, + column: &'b ColumnPath, arrow_schema: &'a Schema, parquet_schema: &'a SchemaDescriptor, ) -> Result<Self> { + let mut fields = arrow_schema.fields(); + + let mut arrow_field = None; // ensure the requested column is in the arrow schema - let Some((_idx, arrow_field)) = arrow_schema.column_with_name(column_name) else { + for part in column.parts() { + if let Some((_idx, inner_arrow_field)) = fields.find(part) { + match inner_arrow_field.data_type() { + DataType::Struct(inner_fields) => { + fields = inner_fields; + } + _ => { + arrow_field = Some(inner_arrow_field); + } + } + } else { + return Err(arrow_err!(format!( + "Column '{}' not found in schema for statistics conversion", + column + ))); + }; + } + + let arrow_field = arrow_field.ok_or(arrow_err!(format!( + "Column '{}' not found in schema for statistics conversion", + column + )))?; + + let mask = + ProjectionMask::columns(parquet_schema, std::iter::once(column.string().as_str())); Review Comment: And use `ProjectionMask::columns`, which handles searching for nested Parquet fields -- 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: github-unsubscr...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org