Skip to content

Commit 2699184

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent 0518bbc commit 2699184

File tree

5 files changed

+27
-36
lines changed

5 files changed

+27
-36
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/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: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
import org.elasticsearch.xpack.esql.expression.function.aggregate.FilteredExpression;
4444
import org.elasticsearch.xpack.esql.expression.function.fulltext.MatchOperator;
4545
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.RLike;
46-
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLike;
4746
import org.elasticsearch.xpack.esql.expression.function.scalar.string.regex.WildcardLikeList;
4847
import org.elasticsearch.xpack.esql.expression.predicate.logical.And;
4948
import org.elasticsearch.xpack.esql.expression.predicate.logical.Not;
@@ -736,12 +735,13 @@ public Expression visitLogicalLikeList(EsqlBaseParser.LogicalLikeListContext ctx
736735

737736
List<Expression> expressions = ctx.valueExpression().stream().map(this::expression).toList();
738737
Source source = source(ctx);
739-
List <WildcardPattern> wildcardPatterns = expressions.subList(1, expressions.size()).stream()
740-
.map(x->new WildcardPattern(x.fold(FoldContext.small()).toString()))
738+
List<WildcardPattern> wildcardPatterns = expressions.subList(1, expressions.size())
739+
.stream()
740+
.map(x -> new WildcardPattern(x.fold(FoldContext.small()).toString()))
741741
.toList();
742-
//Expression e = wildcardPatterns.size() == 1
743-
// ? new WildcardLike( source, expressions.getFirst(),wildcardPatterns.getFirst())
744-
// : new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(wildcardPatterns));
742+
// Expression e = wildcardPatterns.size() == 1
743+
// ? new WildcardLike( source, expressions.getFirst(),wildcardPatterns.getFirst())
744+
// : new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(wildcardPatterns));
745745
Expression e = new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(wildcardPatterns));
746746
return ctx.NOT() == null ? e : new Not(source, e);
747747
}
@@ -754,27 +754,23 @@ public Object visitIsNull(EsqlBaseParser.IsNullContext ctx) {
754754
}
755755

756756
@Override
757-
public Expression visitLikeExpression(EsqlBaseParser.LikeExpressionContext ctx){
757+
public Expression visitLikeExpression(EsqlBaseParser.LikeExpressionContext ctx) {
758758
Source source = source(ctx);
759759
List<Expression> expressions = ctx.valueExpression().stream().map(this::expression).toList();
760760
/*WildcardLike result = new WildcardLike(
761761
source,
762762
expressions.get(0),
763763
new WildcardPattern(expressions.get(1).fold(FoldContext.small() ).toString()));*/
764-
WildcardPattern pattern = new WildcardPattern(expressions.get(1).fold(FoldContext.small() ).toString());
764+
WildcardPattern pattern = new WildcardPattern(expressions.get(1).fold(FoldContext.small()).toString());
765765
WildcardLikeList result = new WildcardLikeList(source, expressions.getFirst(), new WildcardPatternList(List.of(pattern)));
766766
return ctx.NOT() == null ? result : new Not(source, result);
767767
}
768768

769769
@Override
770-
public Expression visitRlikeExpression(EsqlBaseParser.RlikeExpressionContext ctx){
770+
public Expression visitRlikeExpression(EsqlBaseParser.RlikeExpressionContext ctx) {
771771
Source source = source(ctx);
772772
List<Expression> expressions = ctx.valueExpression().stream().map(this::expression).toList();
773-
RLike rLike = new RLike(
774-
source,
775-
expressions.get(0),
776-
new RLikePattern(expressions.get(1).fold(FoldContext.small() ).toString())
777-
);
773+
RLike rLike = new RLike(source, expressions.get(0), new RLikePattern(expressions.get(1).fold(FoldContext.small()).toString()));
778774
return ctx.NOT() == null ? rLike : new Not(source, rLike);
779775
}
780776

0 commit comments

Comments
 (0)