Skip to content

Commit 831889d

Browse files
committed
fix name capture group for extraction
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 8ec0276 commit 831889d

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

core/src/main/java/org/opensearch/sql/calcite/CalciteRelNodeVisitor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,12 @@ public RelNode visitRex(Rex node, CalcitePlanContext context) {
201201
"Rex pattern must contain at least one named capture group");
202202
}
203203

204+
String filterPattern = patternStr.replaceAll("\\(\\?<[a-zA-Z][a-zA-Z0-9]*>", "(");
204205
RexNode regexMatchCondition =
205206
context.rexBuilder.makeCall(
206207
SqlLibraryOperators.REGEXP_CONTAINS,
207208
fieldRex,
208-
context.rexBuilder.makeLiteral(patternStr));
209+
context.rexBuilder.makeLiteral(filterPattern));
209210
context.relBuilder.filter(regexMatchCondition);
210211

211212
List<RexNode> newFields = new ArrayList<>();

0 commit comments

Comments
 (0)