-
Notifications
You must be signed in to change notification settings - Fork 25.6k
[ES|QL] Add a TS variation of GenerativeIT #133804
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This commit adds a variation of the GenerativeRestTest in ES|QL that queries indices marked as time series indices and runs time series aggregations on them (amongst all the other commands already supported in the Generative tests)
e3a4b22 to
82296eb
Compare
|
Edit: This was a comment with a list of bugs, these have either been dealt with or triaged with new individual issues, so I am hiding the original contents of this comment in a drop-down Existing bug 1:Can't combine Example stack traceExisting bug 2:After a few pipes, the date field being used as a timestamp gets lost (note that the example query has many layers of stats commands, meaning it actually runs successfully for the first 4 out of 5 stats commands) Example stack traceAnother (shorter) failing query is Existing bug 3:Verification fails because field being grouped on changes from field to reference ( Example stack trace |
...e/src/javaRestTest/java/org/elasticsearch/xpack/esql/qa/single_node/GenerativeMetricsIT.java
Show resolved
Hide resolved
...server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| public static String metricsAgg(List<Column> previousOutput) { | ||
| String outerCommand = randomFrom("min", "max", "sum", "count", "avg"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there an easy way to include a wider range of aggregation functions that apply on numerics? E.g. std_dev and top should be applicable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this list is probably the closest thing we'd have to that? Could exclude the commands that don't apply? (*_over_time functions, spatial, i/rate, and those 3 internal functions?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, let's give it a shot.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewing the list a little bit more closely, it looks like some of the names (as NamedWriteableRegistry.Entry) might be a little bit different vs the ES|QL names (CountDistinct vs count_distinct) so this might not work actually....
...server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java
Show resolved
Hide resolved
| if (counterField == null) { | ||
| yield null; | ||
| } | ||
| yield "rate(" + counterField + ")"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or last|first_over_time, once supported.
| }; | ||
| if (innerCommand == null) { | ||
| // TODO: figure out a default that maybe makes more sense than using a timestamp field | ||
| innerCommand = "count_over_time(" + randomDateField(previousOutput) + ")"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe * works, though not great.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
count(*) is the default in the normal Stats generator but it breaks when combined with time_series aggregations (bug 1), so until we fix that I don't think we can/should set that as the default here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah we'd need to think of the semantics.. Let's file an issue for the bug btw, good catch :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I will double-check the state of these bugs first before opening an issue; running a few queries I'm getting some completely new bugs so it's possible that some of them might be fixed.
Somewhat related, I think I saw that @not-napoleon was working on something similar to bug 3 (Output has changed)?
...java/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/MetricsStatsGenerator.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, promising! Lemme add Nhat for thoughts too.
|
Quick heads-up: we are moving the query generator to a more convenient place, so that we can reuse it in different contexts, see #134696 It's not merged yet and I can wait a bit, so please let me know if you are close to merging this one. I don't want to block your progress. |
|
@luigidellaquila thank you for letting us know! |
dfb9d59 to
5235b80
Compare
|
Sorry for the force push; the only thing it should've swallowed was the spotlessApply |
...server/src/main/java/org/elasticsearch/xpack/esql/qa/rest/generative/EsqlQueryGenerator.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome.
|
Pinging @elastic/es-storage-engine (Team:StorageEngine) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One comment, great work! Thanks Larisa!
...a/org/elasticsearch/xpack/esql/qa/rest/generative/command/pipe/TimeSeriesStatsGenerator.java
Outdated
Show resolved
Hide resolved
cb6429d to
044e127
Compare
This commit adds a single_node variation of the GenerativeRestTest in ES|QL that queries indices marked as time series indices and runs time series aggregations on them (amongst all the other commands already supported in the Generative tests), with a lot of limitations.