Skip to content

Commit

Permalink
Coerce more REGEX arguments to explicit types
Browse files Browse the repository at this point in the history
  • Loading branch information
dcamper committed Apr 19, 2024
1 parent 4ca8f20 commit 3e94134
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions ecl/hql/hqlgram.y
Original file line number Diff line number Diff line change
Expand Up @@ -6443,11 +6443,20 @@ primexpr1
parser->normalizeExpression($3, type_stringorunicode, false);
parser->checkRegex($3);
if(isUTF8Type($3.queryExprType()))
{
parser->normalizeExpression($3, type_utf8, false);
parser->normalizeExpression($5, type_utf8, false);
}
else if(isUnicodeType($3.queryExprType()))
{
parser->normalizeExpression($3, type_unicode, false);
parser->normalizeExpression($5, type_unicode, false);
}
else
{
parser->normalizeExpression($3, type_string, false);
parser->normalizeExpression($5, type_string, false);
}
$$.setExpr(createValue(no_regex_find, makeBoolType(), $3.getExpr(), $5.getExpr(), $6.getExpr()));
}
| REGEXFIND '(' expression ',' expression ',' expression regexOpt ')'
Expand All @@ -6457,16 +6466,19 @@ primexpr1
Owned<ITypeInfo> subType;
if(isUTF8Type($3.queryExprType()))
{
parser->normalizeExpression($3, type_utf8, false);
parser->normalizeExpression($5, type_utf8, false);
subType.setown(makeUtf8Type(UNKNOWN_LENGTH, 0));
}
else if(isUnicodeType($3.queryExprType()))
{
parser->normalizeExpression($3, type_unicode, false);
parser->normalizeExpression($5, type_unicode, false);
subType.setown(makeUnicodeType(UNKNOWN_LENGTH, 0));
}
else
{
parser->normalizeExpression($3, type_string, false);
parser->normalizeExpression($5, type_string, false);
subType.setown(makeStringType(UNKNOWN_LENGTH));
}
Expand All @@ -6480,16 +6492,19 @@ primexpr1
Owned<ITypeInfo> retType;
if(isUTF8Type($3.queryExprType()))
{
parser->normalizeExpression($3, type_utf8, false);
parser->normalizeExpression($5, type_utf8, false);
retType.setown(makeUtf8Type(UNKNOWN_LENGTH, $3.queryExprType()->queryLocale()));
}
else if(isUnicodeType($3.queryExprType()))
{
parser->normalizeExpression($3, type_unicode, false);
parser->normalizeExpression($5, type_unicode, false);
retType.setown(makeUnicodeType(UNKNOWN_LENGTH, $3.queryExprType()->queryLocale()));
}
else
{
parser->normalizeExpression($3, type_string, false);
parser->normalizeExpression($5, type_string, false);
retType.setown(makeStringType(UNKNOWN_LENGTH));
}
Expand All @@ -6502,18 +6517,21 @@ primexpr1
Owned<ITypeInfo> retType;
if(isUTF8Type($3.queryExprType()))
{
parser->normalizeExpression($3, type_utf8, false);
parser->normalizeExpression($5, type_utf8, false);
parser->normalizeExpression($7, type_utf8, false);
retType.setown(makeUtf8Type(UNKNOWN_LENGTH, 0));
}
else if(isUnicodeType($3.queryExprType()))
{
parser->normalizeExpression($3, type_unicode, false);
parser->normalizeExpression($5, type_unicode, false);
parser->normalizeExpression($7, type_unicode, false);
retType.setown(makeUnicodeType(UNKNOWN_LENGTH, 0));
}
else
{
parser->normalizeExpression($3, type_string, false);
parser->normalizeExpression($5, type_string, false);
parser->normalizeExpression($7, type_string, false);
retType.setown(makeStringType(UNKNOWN_LENGTH));
Expand Down

0 comments on commit 3e94134

Please sign in to comment.