mslapek commented on code in PR #5734: URL: https://github.com/apache/arrow-datafusion/pull/5734#discussion_r1153540699
########## datafusion/expr/src/expr_schema.rs: ########## @@ -68,7 +69,26 @@ impl ExprSchemable for Expr { Expr::OuterReferenceColumn(ty, _) => Ok(ty.clone()), Expr::ScalarVariable(ty, _) => Ok(ty.clone()), Expr::Literal(l) => Ok(l.get_datatype()), - Expr::Case(case) => case.when_then_expr[0].1.get_type(schema), + Expr::Case(case) => { + // when #5681 will be fixed, this code can be reverted to: Review Comment: The type coercion is implemented as an optimizer - and it changes schemas of particular `Expr`essions. And it **takes care** of `Expr::Case`. But `Expr::Projection` caches the schema in itself - so it is not updated! Therefore we get a mismatch between declared schema vs batch schema. Essentially this PR makes `Expr::Case` to **not** change a schema during the coercion optimizer. -- 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...@arrow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org