You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2022/01/21 11:01:28 UTC

[GitHub] [arrow-datafusion] thinkharderdev commented on a change in pull request #1622: Handle merging of evolved schemas in ParquetExec

thinkharderdev commented on a change in pull request #1622:
URL: https://github.com/apache/arrow-datafusion/pull/1622#discussion_r789563040



##########
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:
       Yeah. that makes sense. Fixed!




-- 
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-unsubscribe@arrow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org