Skip to content

Commit 903cd4c

Browse files
authored
Avoid O(N^2) in VALUES with ordinals grouping (#130576) (#130779)
Using the VALUES aggregator with ordinals grouping led to accidental quadratic complexity. Queries like FROM .. | STATS ... VALUES(field) ... BY keyword-field are affected by this performance issue. This change caches a sorted structure - previously used to fix a similar O(N^2) problem when emitting the output block - during the merging phase of the OrdinalGroupingOperator.
1 parent 5520951 commit 903cd4c

File tree

13 files changed

+687
-319
lines changed

13 files changed

+687
-319
lines changed

docs/changelog/130576.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 130576
2+
summary: Avoid O(N^2) in VALUES with ordinals grouping
3+
area: ES|QL
4+
type: bug
5+
issues: []

x-pack/plugin/esql/compute/src/main/generated-src/org/elasticsearch/compute/aggregation/ValuesBytesRefAggregator.java

Lines changed: 131 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)