Skip to content

Commit 239cf1e

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent e1aecf0 commit 239cf1e

File tree

6 files changed

+13
-28
lines changed

6 files changed

+13
-28
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/analysis/Analyzer.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1397,6 +1397,7 @@ private static Expression cast(org.elasticsearch.xpack.esql.core.expression.func
13971397
}
13981398
return f;
13991399
}
1400+
14001401
private static Expression processScalarOrGroupingFunction(
14011402
org.elasticsearch.xpack.esql.core.expression.function.Function f,
14021403
EsqlFunctionRegistry registry

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,18 +67,10 @@ public class Knn extends FullTextFunction implements OptionalArgument, VectorFun
6767
entry(OVERSAMPLE_FIELD.getPreferredName(), FLOAT)
6868
);
6969

70-
@FunctionInfo(
71-
returnType = "boolean",
72-
preview = true,
73-
description = """
74-
Finds the k nearest vectors to a query vector, as measured by a similarity metric.
75-
knn function finds nearest vectors through approximate search on indexed dense_vectors
76-
""",
77-
appliesTo = {
78-
@FunctionAppliesTo(
79-
lifeCycle = FunctionAppliesToLifecycle.DEVELOPMENT
80-
) }
81-
)
70+
@FunctionInfo(returnType = "boolean", preview = true, description = """
71+
Finds the k nearest vectors to a query vector, as measured by a similarity metric.
72+
knn function finds nearest vectors through approximate search on indexed dense_vectors
73+
""", appliesTo = { @FunctionAppliesTo(lifeCycle = FunctionAppliesToLifecycle.DEVELOPMENT) })
8274
public Knn(Source source, Expression field, Expression query, Expression options) {
8375
this(source, field, query, options, null);
8476
}
@@ -89,7 +81,6 @@ public Knn(Source source, Expression field, Expression query, Expression options
8981
this.options = options;
9082
}
9183

92-
9384
public Expression field() {
9485
return field;
9586
}
@@ -187,7 +178,8 @@ public boolean equals(Object o) {
187178
if (o == null || getClass() != o.getClass()) return false;
188179
if (super.equals(o) == false) return false;
189180
Knn knn = (Knn) o;
190-
return Objects.equals(field, knn.field) && Objects.equals(query(), knn.query())
181+
return Objects.equals(field, knn.field)
182+
&& Objects.equals(query(), knn.query())
191183
&& Objects.equals(queryBuilder(), knn.queryBuilder());
192184
}
193185

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@
1212
* from multi values to dense_vector field types, so parameters are actually
1313
* processed as dense_vectors in vector functions
1414
*/
15-
public interface VectorFunction {
16-
}
15+
public interface VectorFunction {}

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public boolean equals(Object o) {
5959
if (!(o instanceof KnnQuery knnQuery)) return false;
6060
if (super.equals(o) == false) return false;
6161
return Objects.equals(field, knnQuery.field)
62-
&& Objects.deepEquals(query, knnQuery.query) && Objects.equals(options, knnQuery.options);
62+
&& Objects.deepEquals(query, knnQuery.query)
63+
&& Objects.equals(options, knnQuery.options);
6364
}
6465

6566
@Override

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/analysis/AnalyzerTests.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
import org.elasticsearch.xpack.esql.expression.function.scalar.convert.ToInteger;
5252
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Concat;
5353
import org.elasticsearch.xpack.esql.expression.function.scalar.string.Substring;
54-
import org.elasticsearch.xpack.esql.expression.predicate.operator.arithmetic.Add;
5554
import org.elasticsearch.xpack.esql.expression.function.vector.Knn;
55+
import org.elasticsearch.xpack.esql.expression.predicate.operator.arithmetic.Add;
5656
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.Equals;
5757
import org.elasticsearch.xpack.esql.expression.predicate.operator.comparison.GreaterThan;
5858
import org.elasticsearch.xpack.esql.index.EsIndex;
@@ -2360,8 +2360,7 @@ public void testDenseVectorImplicitCasting() {
23602360

23612361
var plan = analyze("""
23622362
from test | where knn(vector, [0.342, 0.164, 0.234])
2363-
""",
2364-
"mapping-dense_vector.json");
2363+
""", "mapping-dense_vector.json");
23652364

23662365
var limit = as(plan, Limit.class);
23672366
var filter = as(limit.child(), Filter.class);
@@ -2372,7 +2371,6 @@ public void testDenseVectorImplicitCasting() {
23722371
assertThat(queryVector.value(), equalTo(List.of(0.342, 0.164, 0.234)));
23732372
}
23742373

2375-
23762374
public void testRateRequiresCounterTypes() {
23772375
assumeTrue("rate requires snapshot builds", Build.current().isSnapshot());
23782376
Analyzer analyzer = analyzer(tsdbIndexResolution());

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/parser/StatementParserTests.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -230,13 +230,7 @@ public void testRowCommandWithEscapedFieldName() {
230230

231231
public void testCompositeCommand() {
232232
assertEquals(
233-
new Filter(EMPTY,
234-
new Row(EMPTY,
235-
List.of(
236-
new Alias(EMPTY, "a", integer(1))
237-
)
238-
),
239-
TRUE),
233+
new Filter(EMPTY, new Row(EMPTY, List.of(new Alias(EMPTY, "a", integer(1)))), TRUE),
240234

241235
statement("row a = 1 | where true")
242236
);

0 commit comments

Comments
 (0)