Skip to content

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented Jun 29, 2025

This PR adds unit tests and docs for first_over_time, last_over_time, and rate. For the rate function, the tests currently only verify that the output is a double, not the actual value.

@github-actions
Copy link
Contributor

github-actions bot commented Jun 29, 2025

@dnhatn dnhatn force-pushed the test_first_last branch from cb43722 to ebe72a2 Compare June 29, 2025 16:30
@dnhatn dnhatn force-pushed the test_first_last branch from ebe72a2 to 4da9142 Compare June 29, 2025 17:41
@dnhatn dnhatn changed the title TEST Tests and docs for first/last_over_time and rate Jun 29, 2025
@dnhatn dnhatn changed the title Tests and docs for first/last_over_time and rate Add tests and docs for first/last_over_time and rate Jun 29, 2025
@dnhatn dnhatn added :StorageEngine/TSDB You know, for Metrics :Analytics/ES|QL AKA ESQL ES|QL-ui Impacts ES|QL UI >docs General docs changes labels Jun 30, 2025
@dnhatn dnhatn requested a review from kkrik-es June 30, 2025 03:20
@dnhatn dnhatn marked this pull request as ready for review June 30, 2025 03:20
@elasticsearchmachine elasticsearchmachine added Team:Docs Meta label for docs team Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine labels Jun 30, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-docs (Team:Docs)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-storage-engine (Team:StorageEngine)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/kibana-esql (ES|QL-ui)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How easy it is to add a flag to indicate that these are working only with the TS source command? Otherwise I will have to hardcode them at kibana

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"type" : "time_series_agg",

The time-series aggregation type is time_series_agg, whereas the type of other aggregations is agg. I can add a new flag too.

Copy link

@stratoula stratoula Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see!! No this will work Nhat! Thanx a ton! I totally missed it 🙈

examples = { @Example(file = "k8s-timeseries", tag = "rate") }
)
public Rate(Source source, @Param(name = "field", type = { "counter_long", "counter_integer", "counter_double" }) Expression field) {
this(source, field, new UnresolvedAttribute(source, "@timestamp"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need to resolve the timestamp in this field?

Copy link
Contributor

@kkrik-es kkrik-es left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Nhat.

@dnhatn dnhatn merged commit 6de476a into elastic:main Jun 30, 2025
32 checks passed
@dnhatn dnhatn deleted the test_first_last branch June 30, 2025 16:22
Comment on lines +69 to +76
:::{include} ../_snippets/functions/layout/first_over_time.md
:::

:::{include} ../_snippets/functions/layout/last_over_time.md
:::

:::{include} ../_snippets/functions/layout/rate.md
:::
Copy link
Contributor

@leemthompo leemthompo Jun 30, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dnhatn I see you actually have used applies_to in this PR 👍

BTW curious why you didn't chose to just not include the docs here (thus not publish them) as opposed to publishing them with unavailable markers

It's very early days with the new docs system and just wanna make sure we have somewhat consistent approaches :)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @leemthompo. I opened #130367 to delay publishing these pages until we are ready.

mridula-s109 pushed a commit to mridula-s109/elasticsearch that referenced this pull request Jul 3, 2025
This PR adds unit tests and docs for first_over_time, last_over_time, 
and rate. For the rate function, the tests currently only verify that
the output is a double, not the actual value.
stratoula added a commit to elastic/kibana that referenced this pull request Jul 9, 2025
## Summary

Closes #220730

Supports of TS inner agg functions.

1. Retrieves the functions and the docs from
elastic/elasticsearch#130290
2. Suggest them only when an agg is already selected and only if the
source command is TS


![meow](https://github.com/user-attachments/assets/9143ff0d-c5ab-4e93-a802-3e535dbc5121)


Atm you won't see any changes in the editor. You can test it though if
you change the
`src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/time_series_agg_functions.ts`
`ignoreAsSuggestion` flags to false.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Vadim Kibana <[email protected]>
kertal pushed a commit to kertal/kibana that referenced this pull request Jul 25, 2025
## Summary

Closes elastic#220730

Supports of TS inner agg functions.

1. Retrieves the functions and the docs from
elastic/elasticsearch#130290
2. Suggest them only when an agg is already selected and only if the
source command is TS


![meow](https://github.com/user-attachments/assets/9143ff0d-c5ab-4e93-a802-3e535dbc5121)


Atm you won't see any changes in the editor. You can test it though if
you change the
`src/platform/packages/shared/kbn-esql-validation-autocomplete/src/definitions/generated/time_series_agg_functions.ts`
`ignoreAsSuggestion` flags to false.

### Checklist

- [ ] Any text added follows [EUI's writing
guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses
sentence case text and includes [i18n
support](https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-i18n/README.md)
- [ ]
[Documentation](https://www.elastic.co/guide/en/kibana/master/development-documentation.html)
was added for features that require explanation or tutorials
- [ ] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Vadim Kibana <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL >docs General docs changes ES|QL-ui Impacts ES|QL UI :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:Docs Meta label for docs team Team:StorageEngine v9.2.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants