kumarUjjawal commented on code in PR #22887:
URL: https://github.com/apache/datafusion/pull/22887#discussion_r3396781746
##########
datafusion/optimizer/src/analyzer/type_coercion.rs:
##########
@@ -613,6 +613,33 @@ impl TreeNodeRewriter for TypeCoercionRewriter<'_> {
case_insensitive,
))))
}
+ Expr::SimilarTo(Like {
+ negated,
+ expr,
+ pattern,
+ escape_char,
+ case_insensitive,
+ }) => {
+ let left_type = expr.get_type(self.schema)?;
+ let right_type = pattern.get_type(self.schema)?;
+ let coerced_type = regex_coercion(&left_type,
&right_type).ok_or_else(|| {
+ plan_datafusion_err!(
+ "There isn't a common type to coerce {left_type} and
{right_type} in SIMILAR TO expression"
+ )
+ })?;
+ let expr = match left_type {
Review Comment:
Keeping the dictionary input unchanged can still send a dictionary array
into the array-array regex path, which does not handle dictionary arrays.
For example, `dictionary_string SIMILAR TO NULL` or `dictionary_string
SIMILAR TO pattern_column` can still fail.
Should `SIMILAR TO` cast dictionary strings to the coerced string type here,
or should we add dictionary support to the array-array regex path?
--
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]