kosiew commented on code in PR #17281: URL: https://github.com/apache/datafusion/pull/17281#discussion_r2303007475
########## datafusion/common/src/nested_struct.rs: ########## @@ -159,14 +200,23 @@ pub fn cast_column(source_col: &ArrayRef, target_field: &Field) -> Result<ArrayR pub fn validate_struct_compatibility( source_fields: &[FieldRef], target_fields: &[FieldRef], -) -> Result<bool> { +) -> Result<()> { // Check compatibility for each target field for target_field in target_fields { // Look for matching field in source by name if let Some(source_field) = source_fields .iter() .find(|f| f.name() == target_field.name()) { + // Ensure nullability is compatible. It is invalid to cast a nullable + // source field to a non-nullable target field as this may discard + // null values. Review Comment: Yes. -- 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