Skip to content

Commit 5235b80

Browse files
committed
mute tests, adjust some things, links to issues
1 parent 3a8c89b commit 5235b80

File tree

3 files changed

+29
-29
lines changed

3 files changed

+29
-29
lines changed

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,19 @@
1919
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.KeepGenerator;
2020
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.LimitGenerator;
2121
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.LookupJoinGenerator;
22-
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.TimeSeriesStatsGenerator;
2322
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.MvExpandGenerator;
2423
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.RenameGenerator;
2524
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.SortGenerator;
2625
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.StatsGenerator;
26+
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.TimeSeriesStatsGenerator;
2727
import org.elasticsearch.xpack.esql.qa.rest.generative.command.pipe.WhereGenerator;
2828
import org.elasticsearch.xpack.esql.qa.rest.generative.command.source.FromGenerator;
2929
import org.elasticsearch.xpack.esql.qa.rest.generative.command.source.TimeSeriesGenerator;
3030

3131
import java.util.List;
3232
import java.util.Set;
3333
import java.util.stream.Collectors;
34+
import java.util.stream.Stream;
3435

3536
import static org.elasticsearch.test.ESTestCase.randomAlphaOfLength;
3637
import static org.elasticsearch.test.ESTestCase.randomBoolean;
@@ -79,24 +80,10 @@ public record QueryExecuted(String query, int depth, List<Column> outputSchema,
7980
WhereGenerator.INSTANCE
8081
);
8182

82-
static List<CommandGenerator> TIME_SERIES_PIPE_COMMANDS = List.of(
83-
ChangePointGenerator.INSTANCE,
84-
DissectGenerator.INSTANCE,
85-
DropGenerator.INSTANCE,
86-
EnrichGenerator.INSTANCE,
87-
EvalGenerator.INSTANCE,
88-
ForkGenerator.INSTANCE,
89-
GrokGenerator.INSTANCE,
90-
KeepGenerator.INSTANCE,
91-
LimitGenerator.INSTANCE,
92-
LookupJoinGenerator.INSTANCE,
93-
TimeSeriesStatsGenerator.INSTANCE,
94-
MvExpandGenerator.INSTANCE,
95-
RenameGenerator.INSTANCE,
96-
SortGenerator.INSTANCE,
97-
StatsGenerator.INSTANCE,
98-
WhereGenerator.INSTANCE
99-
);
83+
static List<CommandGenerator> TIME_SERIES_PIPE_COMMANDS = Stream.concat(
84+
PIPE_COMMANDS.stream(),
85+
Stream.of(TimeSeriesStatsGenerator.INSTANCE)
86+
).toList();
10087

10188
public static CommandGenerator sourceCommand() {
10289
return randomFrom(SOURCE_COMMANDS);
@@ -111,7 +98,6 @@ public static CommandGenerator randomPipeCommandGenerator() {
11198
}
11299

113100
public static CommandGenerator randomMetricsPipeCommandGenerator() {
114-
// todo better way
115101
return randomFrom(TIME_SERIES_PIPE_COMMANDS);
116102
}
117103

@@ -143,7 +129,7 @@ public static void generatePipeline(
143129
if (executor.currentSchema().isEmpty()) {
144130
break;
145131
}
146-
commandGenerator = isTimeSeries ? randomMetricsPipeCommandGenerator() : EsqlQueryGenerator.randomPipeCommandGenerator();
132+
commandGenerator = isTimeSeries ? randomMetricsPipeCommandGenerator() : randomPipeCommandGenerator();
147133
desc = commandGenerator.generate(executor.previousCommands(), executor.currentSchema(), schema);
148134
if (desc == CommandGenerator.EMPTY_DESCRIPTION) {
149135
continue;
@@ -266,7 +252,12 @@ yield switch ((randomIntBetween(0, 5))) {
266252
case 0 -> "max_over_time(" + numericPlusAggMetricFieldName + ")";
267253
case 1 -> "min_over_time(" + numericPlusAggMetricFieldName + ")";
268254
case 2 -> "sum_over_time(" + numericPlusAggMetricFieldName + ")";
269-
case 3 -> "present_over_time(" + numericPlusAggMetricFieldName + ")";
255+
case 3 -> {
256+
if (outerCommand.equals("sum") || outerCommand.equals("avg")) {
257+
yield null;
258+
}
259+
yield "present_over_time(" + numericPlusAggMetricFieldName + ")";
260+
}
270261
case 4 -> "count_over_time(" + numericPlusAggMetricFieldName + ")";
271262
default -> "avg_over_time(" + numericPlusAggMetricFieldName + ")";
272263
};
@@ -287,6 +278,13 @@ yield switch ((randomIntBetween(0, 5))) {
287278
if (numericFieldName == null) {
288279
yield null;
289280
}
281+
if (previousOutput.stream()
282+
.noneMatch(
283+
column -> column.name.equals("@timestamp") && (column.type.equals("date_nanos") || column.type.equals("datetime"))
284+
)) {
285+
// first_over_time and last_over_time require @timestamp to be available and be either datetime or date_nanos
286+
yield null;
287+
}
290288
yield (randomBoolean() ? "first_over_time(" : "last_over_time(") + numericFieldName + ")";
291289
}
292290
default -> {

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/GenerativeRestTest.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,12 @@ public abstract class GenerativeRestTest extends ESRestTestCase {
6262
"optimized incorrectly due to missing references", // https://github.com/elastic/elasticsearch/issues/131509
6363

6464
// Awaiting fixes for correctness
65-
"Expecting at most \\[.*\\] columns, got \\[.*\\]" // https://github.com/elastic/elasticsearch/issues/129561
65+
"Expecting at most \\[.*\\] columns, got \\[.*\\]", // https://github.com/elastic/elasticsearch/issues/129561
66+
67+
// TS-command tests
68+
"Invalid call to dataType on an unresolved object \\?LASTOVERTIME", // https://github.com/elastic/elasticsearch/issues/134791
69+
"class org.elasticsearch.compute.data..*Block cannot be cast to class org.elasticsearch.compute.data..*Block", // https://github.com/elastic/elasticsearch/issues/134793
70+
"Output has changed from \\[.*\\] to \\[.*\\]" // https://github.com/elastic/elasticsearch/issues/134794
6671
);
6772

6873
public static final Set<Pattern> ALLOWED_ERROR_PATTERNS = ALLOWED_ERRORS.stream()

x-pack/plugin/esql/qa/server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/TimeSeriesStatsGenerator.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,9 @@ public CommandDescription generate(
8181
}
8282
}
8383
// TODO: add alternative time buckets
84-
cmd.append(
85-
(randomBoolean() ? EsqlQueryGenerator.randomIdentifier() : EsqlQueryGenerator.randomName(previousOutput))
86-
+ " = bucket("
87-
+ timestamp
88-
+ ",1hour)"
89-
);
84+
// TODO: replace name of bucket with half chance of being EsqlQueryGenerator.randomName(previousOutput) if
85+
// is fixed https://github.com/elastic/elasticsearch/issues/134796
86+
cmd.append(EsqlQueryGenerator.randomIdentifier() + " = bucket(" + timestamp + ",1hour)");
9087
return new CommandDescription(STATS, this, cmd.toString(), Map.of());
9188
}
9289

0 commit comments

Comments
 (0)