houqp commented on a change in pull request #1622:
URL: https://github.com/apache/arrow-datafusion/pull/1622#discussion_r789389968
##########
File path: datafusion/src/physical_plan/file_format/parquet.rs
##########
@@ -385,9 +388,35 @@ fn build_row_group_predicate(
}
}
+// Map projections from the schema which merges all file schemas to
projections on a particular
+// file
+fn map_projections(
+ merged_schema: &Schema,
+ file_schema: &Schema,
+ projections: &[usize],
+) -> Vec<usize> {
+ if merged_schema.fields().len() == file_schema.fields().len() {
+ projections.to_vec()
+ } else {
+ let mut mapped: Vec<usize> = vec![];
+ for idx in projections {
+ let field = merged_schema.field(*idx);
+ if let Ok(file_field) =
file_schema.field_with_name(field.name().as_str()) {
Review comment:
perhaps we can call `index_of` first to get the index as a way to check
for existence, then subsequently use `file_schema.field(idx)` to get the field
through direct vector index.
--
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]