neilconway commented on code in PR #20306:
URL: https://github.com/apache/datafusion/pull/20306#discussion_r2805417152
##########
datafusion/optimizer/src/analyzer/type_coercion.rs:
##########
@@ -744,18 +744,47 @@ impl TreeNodeRewriter for TypeCoercionRewriter<'_> {
});
Ok(Transformed::yes(new_expr))
}
+ // IS NULL / IS NOT NULL / SIMILAR TO / CAST / TRY_CAST validate
+ // their inner expressions during type coercion (previously they
were in
+ // the catch-all branch and skipped validation, which caused
panics at
+ // runtime for invalid inner expressions like zero-argument
function calls).
+ // Detail: <https://github.com/apache/datafusion/issues/20201>
+ //
+ // TODO: reject the invalid cases at planning.
+ Expr::IsNotNull(ref inner_expr) | Expr::IsNull(ref inner_expr) => {
+ let _check_type = inner_expr.get_type(self.schema)?;
+ Ok(Transformed::no(expr))
+ }
+ Expr::SimilarTo(Like {
Review Comment:
I filed #20342, I'll take a look at fixing shortly.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]