Skip to content

Commit 2b3944f

Browse files
committed
fix regex exp behavior for non string val
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent cb2fbc7 commit 2b3944f

1 file changed

Lines changed: 2 additions & 5 deletions

File tree

core/src/main/java/org/opensearch/sql/expression/parse/RegexExpression.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,8 @@ public RegexExpression(Expression sourceField, Expression pattern, Expression id
3838

3939
@Override
4040
ExprValue parseValue(ExprValue value) throws ExpressionEvaluationException {
41-
// Convert to string (handles non-string types)
42-
String rawString = RegexCommonUtils.toStringValue(value);
43-
if (rawString == null) {
44-
return new ExprStringValue("");
45-
}
41+
// Use stringValue() which will throw exception for non-string types
42+
String rawString = value.stringValue();
4643

4744
// Extract the specific named group
4845
String extracted = RegexCommonUtils.extractNamedGroup(rawString, regexPattern, identifierStr);

0 commit comments

Comments
 (0)