[opt](Nereids) match predicate support array as first arg (#25172)

This commit is contained in:
morrySnow
2023-10-09 17:17:27 +08:00
committed by GitHub
parent 4de3df6a46
commit d02ef36631
3 changed files with 45 additions and 2 deletions

View File

@ -315,9 +315,11 @@ public class FunctionBinder extends AbstractExpressionRewriteRule {
Expression left = match.left().accept(this, context);
Expression right = match.right().accept(this, context);
// check child type
if (!left.getDataType().isStringLikeType()) {
if (!left.getDataType().isStringLikeType()
&& !(left.getDataType() instanceof ArrayType
&& ((ArrayType) left.getDataType()).getItemType().isStringLikeType())) {
throw new AnalysisException(String.format(
"left operand '%s' part of predicate " + "'%s' should return type 'STRING' but "
"left operand '%s' part of predicate " + "'%s' should return type 'STRING' or 'ARRAY<STRING>' but "
+ "returns type '%s'.",
left.toSql(), match.toSql(), left.getDataType()));
}