From 0dba16384ef51064b079987ba45887d8437f7f2c Mon Sep 17 00:00:00 2001 From: Luigi Dell'Aquila Date: Thu, 19 Jun 2025 18:13:26 +0200 Subject: [PATCH] ES|QL: Fix generative tests (#129717) --- muted-tests.yml | 3 --- .../esql/qa/rest/generative/EsqlQueryGenerator.java | 4 ++-- .../rest/generative/command/pipe/LimitGenerator.java | 10 ++-------- 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/muted-tests.yml b/muted-tests.yml index aa50e8a7d387..7363f92a1cf8 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -562,9 +562,6 @@ tests: - class: org.elasticsearch.search.query.VectorIT method: testFilteredQueryStrategy issue: https://github.com/elastic/elasticsearch/issues/129517 -- class: org.elasticsearch.xpack.esql.qa.single_node.GenerativeIT - method: test - issue: https://github.com/elastic/elasticsearch/issues/129453 - class: org.elasticsearch.test.apmintegration.TracesApmIT method: testApmIntegration issue: https://github.com/elastic/elasticsearch/issues/129651 diff --git a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java index 4cdce12231da..cb0fe098dbf6 100644 --- a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java +++ b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java @@ -13,7 +13,6 @@ import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.DissectGener import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.DropGenerator; import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.EnrichGenerator; import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.EvalGenerator; -import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.ForkGenerator; import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.GrokGenerator; import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.KeepGenerator; import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.LimitGenerator; @@ -54,7 +53,8 @@ public class EsqlQueryGenerator { DropGenerator.INSTANCE, EnrichGenerator.INSTANCE, EvalGenerator.INSTANCE, - ForkGenerator.INSTANCE, + // Awaits fix: https://github.com/elastic/elasticsearch/issues/129715 + // ForkGenerator.INSTANCE, GrokGenerator.INSTANCE, KeepGenerator.INSTANCE, LimitGenerator.INSTANCE, diff --git a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/LimitGenerator.java b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/LimitGenerator.java index d1e6fd8b3bfc..fe94c8feda14 100644 --- a/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/LimitGenerator.java +++ b/x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/LimitGenerator.java @@ -42,15 +42,9 @@ public class LimitGenerator implements CommandGenerator { List> output ) { int limit = (int) commandDescription.context().get(LIMIT); - boolean defaultLimit = false; - for (CommandDescription previousCommand : previousCommands) { - if (previousCommand.commandName().equals(LIMIT)) { - defaultLimit = true; - } - } - if (previousOutput.size() > limit && output.size() != limit || defaultLimit && previousOutput.size() < output.size()) { - return new ValidationResult(false, "Expecting [" + limit + "] records, got [" + output.size() + "]"); + if (output.size() > limit) { + return new ValidationResult(false, "Expecting at most [" + limit + "] records, got [" + output.size() + "]"); } return CommandGenerator.expectSameColumns(previousColumns, columns); }