Skip to content

Commit ca366f3

Browse files
committed
Diagram
1 parent c0c6bde commit ca366f3

File tree

6 files changed

+174
-24
lines changed

6 files changed

+174
-24
lines changed

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

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

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

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

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

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

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

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

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

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

x-pack/plugin/esql/compute/src/main/java/org/elasticsearch/compute/aggregation/X-ValuesAggregator.java.st

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -306,8 +306,21 @@ $endif$
306306
}
307307

308308
/*
309-
* Total the selected groups and turn them into a running count.
310-
* Unselected groups will still have negative counts.
309+
* Total the selected groups and turn the counts into the start index into a sort-of
310+
* off-by-one running count. It's really the number of values that have been inserted
311+
* into the results before starting on this group. Unselected groups will still
312+
* have negative counts.
313+
*
314+
* For example, if
315+
* | Group | Value Count | Selected |
316+
* |-------|-------------|----------|
317+
* | 0 | 3 | <- |
318+
* | 1 | 1 | <- |
319+
* | 2 | 2 | |
320+
* | 3 | 1 | <- |
321+
* | 4 | 4 | <- |
322+
*
323+
* Then the total is 9 and the counts array will contain 0, 3, -2, 4, 5
311324
*/
312325
int total = 0;
313326
for (int s = 0; s < selected.getPositionCount(); s++) {
@@ -319,10 +332,22 @@ $endif$
319332

320333
/*
321334
* Build a list of ids to insert in order *and* convert the running
322-
* count in selectedCounts[group] into the end index in ids for each
323-
* group.
335+
* count in selectedCounts[group] into the end index (exclusive) in
336+
* ids for each group.
324337
* Here we use the negative counts to signal that a group hasn't been
325338
* selected and the id containing values for that group is ignored.
339+
*
340+
* For example, if
341+
* | Group | Value Count | Selected |
342+
* |-------|-------------|----------|
343+
* | 0 | 3 | <- |
344+
* | 1 | 1 | <- |
345+
* | 2 | 2 | |
346+
* | 3 | 1 | <- |
347+
* | 4 | 4 | <- |
348+
*
349+
* Then the total is 9 and the counts array will start with 0, 3, -2, 4, 5.
350+
* The counts will end with 3, 4, -2, 5, 9.
326351
*/
327352
adjust = RamUsageEstimator.alignObjectSize(RamUsageEstimator.NUM_BYTES_ARRAY_HEADER + total * Integer.BYTES);
328353
blockFactory.adjustBreaker(adjust);

0 commit comments

Comments
 (0)