alamb commented on code in PR #14409: URL: https://github.com/apache/datafusion/pull/14409#discussion_r1941881603
########## datafusion/optimizer/src/analyzer/type_coercion.rs: ########## @@ -873,6 +872,21 @@ fn coerce_case_expression(case: Case, schema: &DFSchema) -> Result<Case> { }) }) .transpose()?; + // do checks + if then_types.iter().any(|t| matches!(t, DataType::Struct(_))) + || else_type + .as_ref() + .is_some_and(|t| matches!(t, DataType::Struct(_))) + { + if let Some(ref else_t) = else_type { + then_types.push(else_t.clone()); + try_type_union_resolution_with_struct(&then_types).map_err(|_| { Review Comment: Perhaps we could simply return the error (or at least include the error) rather than returning `""failed to do coercsion for case"` 🤔 -- 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