jayzhan211 commented on issue #11433:
URL: https://github.com/apache/datafusion/issues/11433#issuecomment-2238576514

   cc @eejbyfeldt and @alamb I think @jcsherin find something interesting that 
nullable for list element should be `true` in order to allow computing with 
null element. I think the idea here applies to array_agg too. We probably could 
set nullable to `false` for list in `state_fields`
   
   ```rust
       fn state_fields(&self, args: StateFieldsArgs) -> Result<Vec<Field>> {
           if args.is_distinct {
               return Ok(vec![Field::new_list(
                   format_state_name(args.name, "distinct_array_agg"),
                   Field::new("item", args.input_type.clone(), true),
                   false,
               )]);
           }
   
           Ok(vec![Field::new_list(
               format_state_name(args.name, "array_agg"),
               Field::new("item", args.input_type.clone(), true),
               false,
           )])
       }
   ```
   
   
   I think we should definitely add docs about this, we had several PRs dealing 
with nullability already. It would be helpful for others too.


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