Skip to content

[ES|QL] Fix aggregate_metric_double sorting and mv_expand issues #131658

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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

limotova
Copy link
Contributor

This commit fixes a bug when sorting on multiple indices, where one index contains an aggregate_metric_double field, but at least one other index does not contain that field.
The root issue being that the aggregate_metric_double field, when not present in a doc, will be encoded as a NullBlock (1 value), but later on decoded as an AggregateMetricDouble block (which expects to decode 4 values, even if they're all null).

It also adds an implementation for MV_EXPAND so it just returns the existing block instead of erroring out, as multi-values are not supported for AggregateMetricDoubleBlock.

This commit fixes a bug when sorting on multiple indices, where one
index contains an aggregate_metric_double field, but at least one other
index does not contain that field. The root cause being that the
aggregate_metric_double field, when not present in a doc, will be
encoded as a NullBlock (1 value), but later on decoded as an
AggregateMetricDouble block (which expects to decode 4 values, even if
they're all null).

It also adds an implementation for MV_EXPAND so it just returns the
existing block instead of erroring out, as multi-values are not
supported for AggregateMetricDoubleBlock.
@limotova limotova marked this pull request as ready for review July 22, 2025 04:03
@limotova limotova requested a review from dnhatn July 22, 2025 04:03
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Jul 22, 2025
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine
Copy link
Collaborator

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

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

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

Can you add unit tests for AGGREGATE_METRIC_DOUBLE in ExtractorTests? But the production changes look good. Thanks Larisa!

@limotova limotova added auto-backport Automatically create backport pull requests when merged v9.1.1 v8.19.1 labels Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >bug :StorageEngine/TSDB You know, for Metrics Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) Team:StorageEngine v8.19.1 v9.1.1 v9.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants