Skip to content

Commit 83331f3

Browse files
author
elasticsearchmachine
committed
[CI] Auto commit changes from spotless
1 parent 1fd0cc0 commit 83331f3

File tree

3 files changed

+24
-58
lines changed

3 files changed

+24
-58
lines changed

x-pack/plugin/esql/src/main/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToDenseVector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public ToDenseVector(
5050
Source source,
5151
@Param(
5252
name = "field",
53-
type = {"double", "long", "integer"},
53+
type = { "double", "long", "integer" },
5454
description = "multi-valued input of numbers to convert."
5555
) Expression field
5656
) {

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

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2442,33 +2442,23 @@ private void checkDenseVectorImplicitCastingSimilarityFunction(String similarity
24422442

24432443
public void testDenseVectorEvalCastingSimilarityFunctions() {
24442444
if (EsqlCapabilities.Cap.COSINE_VECTOR_SIMILARITY_FUNCTION.isEnabled()) {
2445-
checkDenseVectorEvalCastingSimilarityFunction(
2446-
"v_cosine(float_vector, query)"
2447-
);
2445+
checkDenseVectorEvalCastingSimilarityFunction("v_cosine(float_vector, query)");
24482446
checkDenseVectorEvalCastingSimilarityFunction("v_cosine(byte_vector, query)");
24492447
}
24502448
if (EsqlCapabilities.Cap.DOT_PRODUCT_VECTOR_SIMILARITY_FUNCTION.isEnabled()) {
2451-
checkDenseVectorEvalCastingSimilarityFunction(
2452-
"v_dot_product(float_vector, query)"
2453-
);
2449+
checkDenseVectorEvalCastingSimilarityFunction("v_dot_product(float_vector, query)");
24542450
checkDenseVectorEvalCastingSimilarityFunction("v_dot_product(byte_vector, query)");
24552451
}
24562452
if (EsqlCapabilities.Cap.L1_NORM_VECTOR_SIMILARITY_FUNCTION.isEnabled()) {
2457-
checkDenseVectorEvalCastingSimilarityFunction(
2458-
"v_l1_norm(float_vector, query)"
2459-
);
2453+
checkDenseVectorEvalCastingSimilarityFunction("v_l1_norm(float_vector, query)");
24602454
checkDenseVectorEvalCastingSimilarityFunction("v_l1_norm(byte_vector, query)");
24612455
}
24622456
if (EsqlCapabilities.Cap.L2_NORM_VECTOR_SIMILARITY_FUNCTION.isEnabled()) {
2463-
checkDenseVectorEvalCastingSimilarityFunction(
2464-
"v_l2_norm(float_vector, query)"
2465-
);
2457+
checkDenseVectorEvalCastingSimilarityFunction("v_l2_norm(float_vector, query)");
24662458
checkDenseVectorEvalCastingSimilarityFunction("v_l2_norm(float_vector, query)");
24672459
}
24682460
if (EsqlCapabilities.Cap.HAMMING_VECTOR_SIMILARITY_FUNCTION.isEnabled()) {
2469-
checkDenseVectorEvalCastingSimilarityFunction(
2470-
"v_hamming(byte_vector, query)"
2471-
);
2461+
checkDenseVectorEvalCastingSimilarityFunction("v_hamming(byte_vector, query)");
24722462
checkDenseVectorEvalCastingSimilarityFunction("v_hamming(byte_vector, query)");
24732463
}
24742464
}

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/expression/function/scalar/convert/ToDenseVectorTests.java

Lines changed: 18 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -34,49 +34,25 @@ public ToDenseVectorTests(@Name("TestCase") Supplier<TestCaseSupplier.TestCase>
3434
public static Iterable<Object[]> parameters() {
3535
List<TestCaseSupplier> suppliers = new ArrayList<>();
3636

37-
suppliers.add(
38-
new TestCaseSupplier(
39-
"int",
40-
List.of(DataType.INTEGER),
41-
() -> {
42-
List<Integer> data = Arrays.asList(randomArray(1, 10, Integer[]::new, ESTestCase::randomInt));
43-
return new TestCaseSupplier.TestCase(
44-
List.of(
45-
new TestCaseSupplier.TypedData(
46-
data,
47-
DataType.INTEGER,
48-
"int"
49-
)
50-
),
51-
evaluatorName("Int", "i"),
52-
DataType.DENSE_VECTOR,
53-
equalTo(data.stream().map(Number::floatValue).toList())
54-
);
55-
}
56-
)
57-
);
37+
suppliers.add(new TestCaseSupplier("int", List.of(DataType.INTEGER), () -> {
38+
List<Integer> data = Arrays.asList(randomArray(1, 10, Integer[]::new, ESTestCase::randomInt));
39+
return new TestCaseSupplier.TestCase(
40+
List.of(new TestCaseSupplier.TypedData(data, DataType.INTEGER, "int")),
41+
evaluatorName("Int", "i"),
42+
DataType.DENSE_VECTOR,
43+
equalTo(data.stream().map(Number::floatValue).toList())
44+
);
45+
}));
5846

59-
suppliers.add(
60-
new TestCaseSupplier(
61-
"long",
62-
List.of(DataType.LONG),
63-
() -> {
64-
List<Long> data = Arrays.asList(randomArray(1, 10, Long[]::new, ESTestCase::randomLong));
65-
return new TestCaseSupplier.TestCase(
66-
List.of(
67-
new TestCaseSupplier.TypedData(
68-
data,
69-
DataType.LONG,
70-
"long"
71-
)
72-
),
73-
evaluatorName("Long", "l"),
74-
DataType.DENSE_VECTOR,
75-
equalTo(data.stream().map(Number::floatValue).toList())
76-
);
77-
}
78-
)
79-
);
47+
suppliers.add(new TestCaseSupplier("long", List.of(DataType.LONG), () -> {
48+
List<Long> data = Arrays.asList(randomArray(1, 10, Long[]::new, ESTestCase::randomLong));
49+
return new TestCaseSupplier.TestCase(
50+
List.of(new TestCaseSupplier.TypedData(data, DataType.LONG, "long")),
51+
evaluatorName("Long", "l"),
52+
DataType.DENSE_VECTOR,
53+
equalTo(data.stream().map(Number::floatValue).toList())
54+
);
55+
}));
8056

8157
return parameterSuppliersFromTypedDataWithDefaultChecksNoErrors(true, suppliers);
8258
}

0 commit comments

Comments
 (0)