|
12 | 12 | import org.elasticsearch.common.io.stream.StreamOutput; |
13 | 13 | import org.elasticsearch.xpack.esql.core.expression.Expression; |
14 | 14 | import org.elasticsearch.xpack.esql.core.expression.FieldAttribute; |
| 15 | +import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePattern; |
15 | 16 | import org.elasticsearch.xpack.esql.core.expression.predicate.regex.RLikePatternList; |
16 | 17 | import org.elasticsearch.xpack.esql.core.querydsl.query.AutomatonQuery; |
17 | 18 | import org.elasticsearch.xpack.esql.core.querydsl.query.Query; |
|
23 | 24 | import org.elasticsearch.xpack.esql.planner.TranslatorHandler; |
24 | 25 |
|
25 | 26 | import java.io.IOException; |
| 27 | +import java.util.stream.Collectors; |
26 | 28 |
|
27 | 29 | public class RLikeList extends RegexMatch<RLikePatternList> { |
28 | 30 | public static final NamedWriteableRegistry.Entry ENTRY = new NamedWriteableRegistry.Entry( |
@@ -95,11 +97,17 @@ public Query asQuery(LucenePushdownPredicates pushdownPredicates, TranslatorHand |
95 | 97 | } |
96 | 98 |
|
97 | 99 | private Query translateField(String targetFieldName) { |
98 | | - return new AutomatonQuery(source(), targetFieldName, pattern().createAutomaton(caseInsensitive())); |
| 100 | + return new AutomatonQuery(source(), targetFieldName, pattern().createAutomaton(caseInsensitive()), getAutomatonDescription()); |
99 | 101 | } |
100 | 102 |
|
101 | 103 | @Override |
102 | 104 | protected NodeInfo<? extends Expression> info() { |
103 | 105 | return NodeInfo.create(this, RLikeList::new, field(), pattern(), caseInsensitive()); |
104 | 106 | } |
| 107 | + |
| 108 | + private String getAutomatonDescription() { |
| 109 | + // we use the information used to create the automaton to describe the query here |
| 110 | + String patternDesc = pattern().patternList().stream().map(RLikePattern::pattern).collect(Collectors.joining("\", \"")); |
| 111 | + return "LIKE(\"" + patternDesc + "\"), caseInsensitive=" + caseInsensitive(); |
| 112 | + } |
105 | 113 | } |
0 commit comments