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 2021/12/02 17:43:59 UTC

[GitHub] [arrow-datafusion] hntd187 commented on a change in pull request #1378: Metadata is kept in projections for non-derived columns

hntd187 commented on a change in pull request #1378:
URL: https://github.com/apache/arrow-datafusion/pull/1378#discussion_r761329193



##########
File path: datafusion/src/physical_plan/projection.rs
##########
@@ -62,18 +61,22 @@ impl ProjectionExec {
     ) -> Result<Self> {
         let input_schema = input.schema();
 
-        let fields: Result<Vec<_>> = expr
+        let fields: Vec<Field> = expr
             .iter()
-            .map(|(e, name)| {
-                Ok(Field::new(
+            .map(|(e, name)| match input_schema.field_with_name(&name) {
+                Ok(f) => f.clone(),
+                Err(_) => Field::new(
                     name,
-                    e.data_type(&input_schema)?,
-                    e.nullable(&input_schema)?,
-                ))
+                    e.data_type(&input_schema).unwrap(),
+                    e.nullable(&input_schema).unwrap_or(true),

Review comment:
       You’re right left me fix that I don’t think I had any reason 




-- 
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