alamb commented on code in PR #14472:
URL: https://github.com/apache/datafusion/pull/14472#discussion_r1942967287


##########
datafusion/expr/src/logical_plan/builder.rs:
##########
@@ -296,12 +298,14 @@ impl LogicalPlanBuilder {
             field_types.push(common_type.unwrap_or(DataType::Null));
         }
 
-        Self::infer_inner(values, &field_types, &schema)
+        let field_nullabilities = (0..n_cols).map(|_| 
true).collect::<Vec<_>>();
+        Self::infer_inner(values, &field_types, &field_nullabilities, &schema)
     }
 
     fn infer_inner(
         mut values: Vec<Vec<Expr>>,
         field_types: &[DataType],
+        field_nullabilities: &[bool],

Review Comment:
   Another way that you could do this is to pass in the fields
   
   like
   
   ```rust
       fn infer_inner(
           mut values: Vec<Vec<Expr>>,
           field_types: &[&Field],
           schema: &DFSchema
       ) -> Result<Self> {
   ```
   
   And then instead of making a new field 
   
   ```rust
               .map(|(j, (data_type, nullable))| {
                   // naming is following convention 
https://www.postgresql.org/docs/current/queries-values.html
                   let name = &format!("column{}", j + 1);
                   Field::new(name, data_type.clone(), *nullable)
               })
   ```
   
   Do something like
   ```rust
               .map(|(j, field)| {
                   // naming is following convention 
https://www.postgresql.org/docs/current/queries-values.html
                   field.clone().with_name(format!("column{}", j + 1))
               })
   ```



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

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to