Skip to content

Commit 4830dc8

Browse files
Add support for RLIKE (LIST)
1 parent bbe2956 commit 4830dc8

File tree

2 files changed

+5
-10
lines changed
  • x-pack/plugin

2 files changed

+5
-10
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/querydsl/query/AutomatonQuery.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected QueryBuilder asBuilder() {
4040

4141
@Override
4242
public int hashCode() {
43-
return Objects.hash(field, automaton);
43+
return Objects.hash(field, automaton, automatonDescription);
4444
}
4545

4646
@Override
@@ -54,7 +54,7 @@ public boolean equals(Object obj) {
5454
}
5555

5656
AutomatonQuery other = (AutomatonQuery) obj;
57-
return Objects.equals(field, other.field) && Objects.equals(automaton, other.automaton);
57+
return Objects.equals(field, other.field) && Objects.equals(automaton, other.automaton) && Objects.equals(automatonDescription, other.automatonDescription);
5858
}
5959

6060
@Override

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/string/regex/WildcardLikeList.java

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -112,16 +112,11 @@ public Query asQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHand
112112
* Throws an {@link IllegalArgumentException} if the pattern list contains more than one pattern.
113113
*/
114114
private Query translateField(String targetFieldName) {
115-
return new AutomatonQuery(
116-
source(),
117-
targetFieldName,
118-
pattern().createAutomaton(caseInsensitive()),
119-
getAutomatonDescription(targetFieldName)
120-
);
115+
return new AutomatonQuery(source(), targetFieldName, pattern().createAutomaton(caseInsensitive()), getAutomatonDescription());
121116
}
122117

123-
private String getAutomatonDescription(String targetFieldName) {
124-
// we use all the information used the create the automaton to describe the query here
118+
private String getAutomatonDescription() {
119+
// we use the information used to create the automaton to describe the query here
125120
String patternDesc = pattern().patternList().stream().map(WildcardPattern::pattern).collect(Collectors.joining("\", \""));
126121
return "LIKE(\"" + patternDesc + "\"), caseInsensitive=" + caseInsensitive();
127122
}

0 commit comments

Comments
 (0)