Skip to content

Commit 495d6b8

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent f39ef12 commit 495d6b8

File tree

6 files changed

+29
-39
lines changed

6 files changed

+29
-39
lines changed

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/WildcardPattern.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public WildcardPattern(String pattern) {
3737
// early initialization to force string validation
3838
this.regex = StringUtils.wildcardToJavaPattern(pattern, '\\');
3939
}
40-
public WildcardPattern(StreamInput in) throws IOException{
40+
41+
public WildcardPattern(StreamInput in) throws IOException {
4142
this(in.readString());
4243
}
4344

x-pack/plugin/esql-core/src/main/java/org/elasticsearch/xpack/esql/core/expression/predicate/regex/WildcardPatternList.java

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,7 @@
2727
*
2828
*/
2929
public class WildcardPatternList extends AbstractStringPattern implements NamedWriteable {
30-
public static final Entry ENTRY = new Entry(
31-
WildcardPatternList.class,
32-
"WildcardPatternList",
33-
WildcardPatternList::new
34-
);
30+
public static final Entry ENTRY = new Entry(WildcardPatternList.class, "WildcardPatternList", WildcardPatternList::new);
3531
public static final String NAME = "WildcardPatternList";
3632
private final List<WildcardPattern> patternList;
3733

@@ -56,20 +52,21 @@ public void writeTo(StreamOutput out) throws IOException {
5652
public String getWriteableName() {
5753
return NAME;
5854
}
59-
public static WildcardPatternList readFrom(StreamInput in) throws IOException{
55+
56+
public static WildcardPatternList readFrom(StreamInput in) throws IOException {
6057
return new WildcardPatternList(in.readCollectionAsList(WildcardPattern::readFrom));
6158
}
6259

6360
public List<WildcardPattern> patternList() {
6461
return patternList;
6562
}
66-
//public String pattern() {
67-
// return wildcard;
68-
//}
63+
// public String pattern() {
64+
// return wildcard;
65+
// }
6966

7067
@Override
7168
public Automaton createAutomaton(boolean ignoreCase) {
72-
List<Automaton> automatonList = patternList.stream().map(x->x.createAutomaton(ignoreCase)).toList();
69+
List<Automaton> automatonList = patternList.stream().map(x -> x.createAutomaton(ignoreCase)).toList();
7370
Automaton result = Operations.union(automatonList);
7471
return Operations.determinize(result, Operations.DEFAULT_DETERMINIZE_WORK_LIMIT);
7572
}
@@ -81,7 +78,7 @@ public String asJavaRegex() {
8178

8279
@Override
8380
public String pattern() {
84-
return "(\"" + patternList.stream().map(WildcardPattern::pattern).collect(Collectors.joining("\", \"")) + "\")";
81+
return "(\"" + patternList.stream().map(WildcardPattern::pattern).collect(Collectors.joining("\", \"")) + "\")";
8582
}
8683

8784
/**
@@ -91,13 +88,12 @@ public String asLuceneWildcard() {
9188
throw new RuntimeException("LIKELIST does not have a Lucine Wildcard");
9289
}
9390

94-
9591
/**
9692
* Returns the pattern in (IndexNameExpressionResolver) wildcard format.
9793
*/
98-
//public String asIndexNameWildcard() {
99-
// return wildcard;
100-
//}
94+
// public String asIndexNameWildcard() {
95+
// return wildcard;
96+
// }
10197

10298
@Override
10399
public int hashCode() {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/action/EsqlCapabilities.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1192,8 +1192,6 @@ public enum Cap {
11921192
*/
11931193
LIKE_WITH_LIST_OF_PATTERNS;
11941194

1195-
1196-
11971195
private final boolean enabled;
11981196

11991197
Cap() {

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/EsqlFunctionRegistry.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@
178178
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToLower;
179179
import org.elasticsearch.xpack.esql.expression.function.scalar.string.ToUpper;
180180
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Trim;
181-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLikeList;
182181
import org.elasticsearch.xpack.esql.expression.function.scalar.util.Delay;
183182
import org.elasticsearch.xpack.esql.parser.ParsingException;
184183
import org.elasticsearch.xpack.esql.session.Configuration;
@@ -418,8 +417,8 @@ private static FunctionDefinition[][] functions() {
418417
// IP
419418
new FunctionDefinition[] { def(CIDRMatch.class, CIDRMatch::new, "cidr_match") },
420419
new FunctionDefinition[] { def(IpPrefix.class, IpPrefix::new, "ip_prefix") },
421-
//likelist
422-
//new FunctionDefinition[] { def(WildcardLikeList.class, WildcardLikeList::new, "like_list") },
420+
// likelist
421+
// new FunctionDefinition[] { def(WildcardLikeList.class, WildcardLikeList::new, "like_list") },
423422

424423
// conversion functions
425424
new FunctionDefinition[] {

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ public WildcardLikeList(StreamInput in) throws IOException {
7575
);
7676
}
7777

78-
7978
@Override
8079
public void writeTo(StreamOutput out) throws IOException {
8180
source().writeTo(out);
@@ -106,8 +105,8 @@ protected WildcardLikeList replaceChild(Expression newLeft) {
106105

107106
@Override
108107
public Translatable translatable(LucenePushdownPredicates pushdownPredicates) {
109-
if(pattern().patternList().size() != 1){
110-
//we only support a single pattern in the list for pushdown for now
108+
if (pattern().patternList().size() != 1) {
109+
// we only support a single pattern in the list for pushdown for now
111110
return Translatable.NO;
112111
}
113112
return pushdownPredicates.isPushableAttribute(field()) ? Translatable.YES : Translatable.NO;

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/parser/ExpressionBuilder.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -736,12 +736,13 @@ public Expression visitLogicalLikeList(EsqlBaseParser.LogicalLikeListContext ctx
736736

737737
List<Expression> expressions = ctx.valueExpression().stream().map(this::expression).toList();
738738
Source source = source(ctx);
739-
List <WildcardPattern> wildcardPatterns = expressions.subList(1, expressions.size()).stream()
740-
.map(x->new WildcardPattern(x.fold(FoldContext.small()).toString()))
739+
List<WildcardPattern> wildcardPatterns = expressions.subList(1, expressions.size())
740+
.stream()
741+
.map(x -> new WildcardPattern(x.fold(FoldContext.small()).toString()))
741742
.toList();
742-
//for now we will use the old WildcardLike function as much as possible to allow compatibility in mixed version deployments
743+
// for now we will use the old WildcardLike function as much as possible to allow compatibility in mixed version deployments
743744
Expression e = wildcardPatterns.size() == 1
744-
? new WildcardLike( source, expressions.getFirst(),wildcardPatterns.getFirst())
745+
? new WildcardLike(source, expressions.getFirst(), wildcardPatterns.getFirst())
745746
: new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(wildcardPatterns));
746747
return ctx.NOT() == null ? e : new Not(source, e);
747748
}
@@ -754,25 +755,21 @@ public Object visitIsNull(EsqlBaseParser.IsNullContext ctx) {
754755
}
755756

756757
@Override
757-
public Expression visitLikeExpression(EsqlBaseParser.LikeExpressionContext ctx){
758+
public Expression visitLikeExpression(EsqlBaseParser.LikeExpressionContext ctx) {
758759
Source source = source(ctx);
759760
List<Expression> expressions = ctx.valueExpression().stream().map(this::expression).toList();
760-
WildcardPattern pattern = new WildcardPattern(expressions.get(1).fold(FoldContext.small() ).toString());
761-
//for now we will use the old WildcardLike function as much as possible to allow compatibility in mixed version deployments
762-
WildcardLike result = new WildcardLike(source, expressions.get(0), pattern);
763-
//WildcardLikeList result = new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(List.of(pattern)));
761+
WildcardPattern pattern = new WildcardPattern(expressions.get(1).fold(FoldContext.small()).toString());
762+
// for now we will use the old WildcardLike function as much as possible to allow compatibility in mixed version deployments
763+
WildcardLike result = new WildcardLike(source, expressions.get(0), pattern);
764+
// WildcardLikeList result = new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(List.of(pattern)));
764765
return ctx.NOT() == null ? result : new Not(source, result);
765766
}
766767

767768
@Override
768-
public Expression visitRlikeExpression(EsqlBaseParser.RlikeExpressionContext ctx){
769+
public Expression visitRlikeExpression(EsqlBaseParser.RlikeExpressionContext ctx) {
769770
Source source = source(ctx);
770771
List<Expression> expressions = ctx.valueExpression().stream().map(this::expression).toList();
771-
RLike rLike = new RLike(
772-
source,
773-
expressions.get(0),
774-
new RLikePattern(expressions.get(1).fold(FoldContext.small() ).toString())
775-
);
772+
RLike rLike = new RLike(source, expressions.get(0), new RLikePattern(expressions.get(1).fold(FoldContext.small()).toString()));
776773
return ctx.NOT() == null ? rLike : new Not(source, rLike);
777774
}
778775

0 commit comments

Comments
 (0)