Skip to content

Commit 7d0ee1a

Browse files
Fix failing release tests (Require capability for DECAY function and SET and INLINESTATS commands) (#134358)
Three PRs have just been merged that cause failures in `test-release`, and a third PR changes ES|QL railroad diagrams for another recently released change to `KNN` (also a snapshot-only feature). * #132729 - `DecayTests` has over 300 failures * #134029 - `ParsingTests` had six new failures * #124725 - Failures in `VerifierTests` and `OptimizerVerificationTests` This PR attempts to fix all in one, because if we do this in separate PRs they will fail due to the failures cause by the other PRs.
1 parent 585cabd commit 7d0ee1a

File tree

8 files changed

+24
-3
lines changed

8 files changed

+24
-3
lines changed

docs/reference/query-languages/esql/images/functions/decay.svg

Lines changed: 1 addition & 1 deletion
Loading

docs/reference/query-languages/esql/images/functions/knn.svg

Lines changed: 1 addition & 1 deletion
Loading

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,6 +1329,11 @@ public enum Cap {
13291329
*/
13301330
FIX_MV_EXPAND_INCONSISTENT_COLUMN_ORDER,
13311331

1332+
/**
1333+
* Support for the SET command.
1334+
*/
1335+
SET_COMMAND(Build.current().isSnapshot()),
1336+
13321337
/**
13331338
* (Re)Added EXPLAIN command
13341339
*/

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ public void testInvalidSample() {
213213
}
214214

215215
public void testSet() {
216+
assumeTrue("SET command available in snapshot only", EsqlCapabilities.Cap.SET_COMMAND.isEnabled());
216217
EsqlStatement query = parse("SET foo = \"bar\"; row a = 1", new QueryParams());
217218
assertThat(query.plan(), is(instanceOf(Row.class)));
218219
assertThat(query.settings().size(), is(1));
@@ -232,6 +233,7 @@ public void testSet() {
232233
}
233234

234235
public void testSetWithTripleQuotes() {
236+
assumeTrue("SET command available in snapshot only", EsqlCapabilities.Cap.SET_COMMAND.isEnabled());
235237
EsqlStatement query = parse("SET foo = \"\"\"bar\"baz\"\"\"; row a = 1", new QueryParams());
236238
assertThat(query.plan(), is(instanceOf(Row.class)));
237239
assertThat(query.settings().size(), is(1));
@@ -249,6 +251,7 @@ public void testSetWithTripleQuotes() {
249251
}
250252

251253
public void testMultipleSet() {
254+
assumeTrue("SET command available in snapshot only", EsqlCapabilities.Cap.SET_COMMAND.isEnabled());
252255
EsqlStatement query = parse(
253256
"SET foo = \"bar\"; SET bar = 2; SET foo = \"baz\"; SET x = 3.5; SET y = false; SET z = null; row a = 1",
254257
new QueryParams()
@@ -265,6 +268,7 @@ public void testMultipleSet() {
265268
}
266269

267270
public void testSetArrays() {
271+
assumeTrue("SET command available in snapshot only", EsqlCapabilities.Cap.SET_COMMAND.isEnabled());
268272
EsqlStatement query = parse("SET foo = [\"bar\", \"baz\"]; SET bar = [1, 2, 3]; row a = 1", new QueryParams());
269273
assertThat(query.plan(), is(instanceOf(Row.class)));
270274
assertThat(query.settings().size(), is(2));
@@ -274,6 +278,7 @@ public void testSetArrays() {
274278
}
275279

276280
public void testSetWithNamedParams() {
281+
assumeTrue("SET command available in snapshot only", EsqlCapabilities.Cap.SET_COMMAND.isEnabled());
277282
EsqlStatement query = parse(
278283
"SET foo = \"bar\"; SET bar = ?a; SET foo = \"baz\"; SET x = ?x; row a = 1",
279284
new QueryParams(
@@ -293,6 +298,7 @@ public void testSetWithNamedParams() {
293298
}
294299

295300
public void testSetWithPositionalParams() {
301+
assumeTrue("SET command available in snapshot only", EsqlCapabilities.Cap.SET_COMMAND.isEnabled());
296302
EsqlStatement query = parse(
297303
"SET foo = \"bar\"; SET bar = ?; SET foo = \"baz\"; SET x = ?; row a = ?",
298304
new QueryParams(

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2069,6 +2069,8 @@ public void testCategorizeOptionSimilarityThreshold() {
20692069
}
20702070

20712071
public void testCategorizeWithInlineStats() {
2072+
assumeTrue("CATEGORIZE must be enabled", EsqlCapabilities.Cap.CATEGORIZE_V6.isEnabled());
2073+
assumeTrue("INLINESTATS must be enabled", EsqlCapabilities.Cap.INLINESTATS_V11.isEnabled());
20722074
assertEquals(
20732075
"1:37: CATEGORIZE [CATEGORIZE(last_name, { \"similarity_threshold\": 1 })] is not yet supported with "
20742076
+ "INLINESTATS [INLINESTATS COUNT(*) BY CATEGORIZE(last_name, { \"similarity_threshold\": 1 })]",

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,15 @@
1313
import org.elasticsearch.common.geo.GeoPoint;
1414
import org.elasticsearch.common.unit.DistanceUnit;
1515
import org.elasticsearch.script.ScoreScriptUtils;
16+
import org.elasticsearch.xpack.esql.action.EsqlCapabilities;
1617
import org.elasticsearch.xpack.esql.core.expression.Expression;
1718
import org.elasticsearch.xpack.esql.core.expression.Literal;
1819
import org.elasticsearch.xpack.esql.core.expression.MapExpression;
1920
import org.elasticsearch.xpack.esql.core.tree.Source;
2021
import org.elasticsearch.xpack.esql.core.type.DataType;
2122
import org.elasticsearch.xpack.esql.expression.function.AbstractScalarFunctionTestCase;
2223
import org.elasticsearch.xpack.esql.expression.function.TestCaseSupplier;
24+
import org.junit.BeforeClass;
2325

2426
import java.time.Duration;
2527
import java.time.Instant;
@@ -44,6 +46,11 @@ public DecayTests(@Name("TestCase") Supplier<TestCaseSupplier.TestCase> testCase
4446
this.testCase = testCaseSupplier.get();
4547
}
4648

49+
@BeforeClass
50+
public static void checkCapability() {
51+
assumeTrue("Decay function tests require the DECAY_FUNCTION capability", EsqlCapabilities.Cap.DECAY_FUNCTION.isEnabled());
52+
}
53+
4754
@ParametersFactory
4855
public static Iterable<Object[]> parameters() {
4956
List<TestCaseSupplier> testCaseSuppliers = new ArrayList<>();

x-pack/plugin/esql/src/test/java/org/elasticsearch/xpack/esql/optimizer/OptimizerVerificationTests.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,7 @@ public void testRemoteEnrichAfterLookupJoinWithPipelineBreaker() {
431431
}
432432

433433
public void testDanglingOrderByInInlineStats() {
434+
assumeTrue("INLINESTATS must be enabled", EsqlCapabilities.Cap.INLINESTATS_V11.isEnabled());
434435
var analyzer = AnalyzerTestUtils.analyzer(loadMapping("mapping-default.json", "test"));
435436

436437
var err = error("""

x-pack/plugin/src/yamlRestTest/resources/rest-api-spec/test/esql/60_usage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ setup:
225225
- gt: {esql.functions.to_long: $functions_to_long}
226226
- match: {esql.functions.coalesce: $functions_coalesce}
227227
- gt: {esql.functions.categorize: $functions_categorize}
228-
- length: {esql.functions: 142} # check the "sister" test above for a likely update to the same esql.functions length check
228+
- length: {esql.functions: 144} # check the "sister" test above for a likely update to the same esql.functions length check
229229

230230
---
231231
took:

0 commit comments

Comments
 (0)