Skip to content

Commit 064fbd8

Browse files
committed
comment clean up
Signed-off-by: Jialiang Liang <jiallian@amazon.com>
1 parent 6db9a47 commit 064fbd8

6 files changed

Lines changed: 12 additions & 27 deletions

File tree

core/build.gradle

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ plugins {
3434

3535
repositories {
3636
mavenCentral()
37-
maven { url 'https://jitpack.io' }
3837
}
3938

4039
pitest {

core/src/main/java/org/opensearch/sql/analysis/Analyzer.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -699,14 +699,12 @@ public LogicalPlan visitRegex(Regex node, AnalysisContext context) {
699699
Expression fieldExpr = expressionAnalyzer.analyze(node.getField(), context);
700700
Expression patternExpr = expressionAnalyzer.analyze(node.getPattern(), context);
701701

702-
// Create the RegexMatch expression directly
703-
// This is our custom Java regex implementation
702+
// Create the RegexMatch expression
704703
Expression regexExpr =
705704
new org.opensearch.sql.expression.operator.predicate.RegexMatch(
706705
fieldExpr, patternExpr, node.isNegated());
707706

708707
// Return a LogicalFilter with the regex condition
709-
// No need for optimization since RegexMatch is already a concrete expression
710708
LogicalFilter result = new LogicalFilter(child, regexExpr);
711709

712710
return result;

core/src/main/java/org/opensearch/sql/ast/tree/Regex.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ public class Regex extends UnresolvedPlan {
3333
@Setter private UnresolvedPlan child;
3434

3535
public Regex(UnresolvedExpression field, String operator, Literal pattern) {
36-
// Require explicit field - no default to _source for PoC
3736
this.field = field;
3837
this.negated = "!=".equals(operator);
3938
this.pattern = pattern;

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

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -174,16 +174,16 @@ public RelNode visitFilter(Filter node, CalcitePlanContext context) {
174174
public RelNode visitRegex(Regex node, CalcitePlanContext context) {
175175
visitChildren(node, context);
176176

177-
// Create our Java regex RegexMatch expression directly, just like the legacy engine
178-
// This ensures both engines use identical Java regex implementation
179-
180-
// Analyze the field and pattern expressions in the current context
177+
// Analyze the field and pattern expressions
181178
RexNode fieldRex = rexVisitor.analyze(node.getField(), context);
182179
RexNode patternRex = rexVisitor.analyze(node.getPattern(), context);
183180

184-
// Create a custom RexNode that represents our RegexMatch expression
185-
// This will be handled by the script engine with Java regex support
186-
RexNode regexCondition = createRegexMatchRexNode(fieldRex, patternRex, context);
181+
// Create RexNode using the REGEX_MATCH UDF
182+
RexNode regexCondition =
183+
context.rexBuilder.makeCall(
184+
org.opensearch.sql.expression.function.PPLBuiltinOperators.REGEX_MATCH,
185+
fieldRex,
186+
patternRex);
187187

188188
// If negated, wrap with NOT
189189
if (node.isNegated()) {
@@ -194,14 +194,6 @@ public RelNode visitRegex(Regex node, CalcitePlanContext context) {
194194
return context.relBuilder.peek();
195195
}
196196

197-
private RexNode createRegexMatchRexNode(
198-
RexNode field, RexNode pattern, CalcitePlanContext context) {
199-
// Use the UDF version that has proper enumerable implementation support
200-
// This ensures Java regex usage for both pushdown and in-memory execution
201-
return context.rexBuilder.makeCall(
202-
org.opensearch.sql.expression.function.PPLBuiltinOperators.REGEX_MATCH, field, pattern);
203-
}
204-
205197
private boolean containsSubqueryExpression(Node expr) {
206198
if (expr == null) {
207199
return false;

core/src/main/java/org/opensearch/sql/expression/function/udf/RegexMatchFunctionImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public static Boolean eval(String field, String pattern) {
6767
return null;
6868
}
6969

70-
// Use Java regex library for evaluation (same logic as RegexMatch)
70+
// Match using find() for partial match semantics
7171
try {
7272
Pattern compiledPattern = Pattern.compile(pattern);
7373
java.util.regex.Matcher matcher = compiledPattern.matcher(field);

core/src/main/java/org/opensearch/sql/expression/operator/predicate/RegexMatch.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,9 @@
2121
import org.opensearch.sql.expression.env.Environment;
2222

2323
/**
24-
* Expression for regex matching using Java's built-in regex engine. Supports Java regex features
25-
* including: - Named groups (?<name>...) - Lookahead/lookbehind (limited to fixed-width) -
26-
* Backreferences - Atomic groups (?>...) - Possessive quantifiers (*+, ++, etc.) - Inline flags
27-
* (?i), (?m), (?s), etc.
28-
*
29-
* <p>Note: Does not support PCRE-specific features like recursion (?R) or conditionals.
24+
* Expression for regex matching using Java's built-in regex engine. Supports standard Java regex
25+
* features including named groups, lookahead/lookbehind, backreferences, and inline flags. Uses
26+
* find() for partial matching to align with SPL semantics.
3027
*/
3128
@ToString
3229
@EqualsAndHashCode

0 commit comments

Comments
 (0)