Skip to content
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

Don't validate internal stats if they are empty #113846

Merged
merged 3 commits into from
Oct 4, 2024

Conversation

iverase
Copy link
Contributor

@iverase iverase commented Oct 1, 2024

In #107678 we introduced a validation step when creating InternalStats to avoid crashing when serializing the object to json. Unfortunately this check might avoid empty aggregations (when the count metric is equal to zero) to work.

What we note is that the serialization of empty aggregations is hard coded to certain values so it does not need to be validated. Therefore this commit adds a check before validating so we only validate aggregations when count != 0.

fixes #113811

@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Oct 1, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

Hi @iverase, I've created a changelog YAML for you.

@iverase
Copy link
Contributor Author

iverase commented Oct 1, 2024

@elasticmachine update branch

Copy link
Member

@not-napoleon not-napoleon left a comment

Choose a reason for hiding this comment

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

LGTM.

@iverase iverase merged commit 0ef5219 into elastic:main Oct 4, 2024
16 checks passed
@iverase iverase deleted the statsCountZero branch October 4, 2024 13:46
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
8.x
8.15

iverase added a commit to iverase/elasticsearch that referenced this pull request Oct 4, 2024
Fixes a validation step that might prevent creating empty aggregations iif the output format does not 
allows negative numbers.
iverase added a commit to iverase/elasticsearch that referenced this pull request Oct 4, 2024
Fixes a validation step that might prevent creating empty aggregations iif the output format does not 
allows negative numbers.
elasticsearchmachine pushed a commit that referenced this pull request Oct 4, 2024
Fixes a validation step that might prevent creating empty aggregations iif the output format does not 
allows negative numbers.
elasticsearchmachine pushed a commit that referenced this pull request Oct 4, 2024
Fixes a validation step that might prevent creating empty aggregations iif the output format does not 
allows negative numbers.
matthewabbott pushed a commit to matthewabbott/elasticsearch that referenced this pull request Oct 10, 2024
Fixes a validation step that might prevent creating empty aggregations iif the output format does not 
allows negative numbers.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/Aggregations Aggregations >bug Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.15.3 v8.16.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

stats and extended_stats aggregation unexpectedly fails with "Cannot format stat [max] with format ..."
4 participants