Commit d65f34d
authored
Push down field extraction to time-series source (#127445)
This change pushes down field extractions to the time-series source
operator, providing these advantages:
- Avoids building `DocVector` and its forward/backward maps.
- Leverages the `DocValues` cache (i.e., blocks that are already
decompressed/decoded) when loading values, which can be lost when
reading blocks with the `ValuesSourceReaderOperator`.
- Eliminates the need to rebuild blocks with backward mappings after
reading values.
The following query against the TSDB track previously took 19 seconds
but was reduced to 13 seconds with this change:
```
TS tsdb
| STATS sum(rate(kubernetes.container.memory.pagefaults)) by bucket(@timestamp, 5minute)
```
Note that with this change:
```
TS tsdb
| STATS sum(rate(kubernetes.container.memory.pagefaults)) by bucket(@timestamp, 5minute)
```
now performs as well as:
```
FROM tsdb
| STATS sum(last_over_time(kubernetes.container.memory.pagefaults)) by bucket(@timestamp, 5minute)
```
when using the shard level data partitioning. This means the performance
of the TS command is comparable to the `FROM` command, except that it
does not yet support segment-level or doc-level concurrency. I will try
to add support for segment-level concurrency, as document-level
partitioning is not useful when iterating over documents in order.1 parent 637807c commit d65f34d
File tree
12 files changed
+637
-184
lines changed- x-pack/plugin/esql
- compute/src
- main/java/org/elasticsearch/compute/lucene
- test/java/org/elasticsearch/compute/lucene
- src
- main/java/org/elasticsearch/xpack/esql
- optimizer
- rules/physical/local
- planner
- plan/physical
- test/java/org/elasticsearch/xpack/esql/optimizer
12 files changed
+637
-184
lines changedLines changed: 14 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
11 | 15 | | |
12 | 16 | | |
13 | 17 | | |
| |||
39 | 43 | | |
40 | 44 | | |
41 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
42 | 56 | | |
Lines changed: 275 additions & 73 deletions
Large diffs are not rendered by default.
Lines changed: 31 additions & 24 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
643 | | - | |
| 642 | + | |
644 | 643 | | |
645 | 644 | | |
646 | 645 | | |
647 | 646 | | |
648 | | - | |
| 647 | + | |
649 | 648 | | |
650 | 649 | | |
651 | 650 | | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
652 | 680 | | |
653 | 681 | | |
654 | 682 | | |
| |||
704 | 732 | | |
705 | 733 | | |
706 | 734 | | |
707 | | - | |
708 | | - | |
709 | | - | |
710 | | - | |
711 | | - | |
712 | | - | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | 735 | | |
729 | 736 | | |
730 | 737 | | |
| |||
Lines changed: 16 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
| 38 | + | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
299 | 301 | | |
300 | 302 | | |
301 | 303 | | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
302 | 318 | | |
303 | 319 | | |
304 | 320 | | |
| |||
Lines changed: 31 additions & 15 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
155 | 156 | | |
156 | 157 | | |
157 | 158 | | |
| 159 | + | |
158 | 160 | | |
159 | 161 | | |
160 | 162 | | |
| 163 | + | |
| 164 | + | |
161 | 165 | | |
162 | 166 | | |
163 | 167 | | |
| |||
171 | 175 | | |
172 | 176 | | |
173 | 177 | | |
174 | | - | |
175 | 178 | | |
176 | 179 | | |
177 | 180 | | |
178 | 181 | | |
179 | | - | |
| 182 | + | |
180 | 183 | | |
181 | 184 | | |
182 | 185 | | |
| |||
240 | 243 | | |
241 | 244 | | |
242 | 245 | | |
| 246 | + | |
243 | 247 | | |
| 248 | + | |
244 | 249 | | |
245 | 250 | | |
246 | 251 | | |
| |||
260 | 265 | | |
261 | 266 | | |
262 | 267 | | |
263 | | - | |
| 268 | + | |
264 | 269 | | |
265 | 270 | | |
266 | 271 | | |
| |||
279 | 284 | | |
280 | 285 | | |
281 | 286 | | |
| 287 | + | |
| 288 | + | |
282 | 289 | | |
283 | 290 | | |
284 | 291 | | |
| 292 | + | |
| 293 | + | |
285 | 294 | | |
286 | 295 | | |
287 | 296 | | |
| |||
300 | 309 | | |
301 | 310 | | |
302 | 311 | | |
303 | | - | |
304 | | - | |
305 | 312 | | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
| 313 | + | |
315 | 314 | | |
316 | 315 | | |
317 | 316 | | |
| |||
321 | 320 | | |
322 | 321 | | |
323 | 322 | | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
324 | 327 | | |
325 | 328 | | |
326 | 329 | | |
| 330 | + | |
| 331 | + | |
327 | 332 | | |
328 | 333 | | |
329 | 334 | | |
| |||
354 | 359 | | |
355 | 360 | | |
356 | 361 | | |
357 | | - | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
358 | 374 | | |
359 | 375 | | |
360 | 376 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
| 498 | + | |
499 | 499 | | |
500 | 500 | | |
501 | 501 | | |
| |||
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
| |||
Lines changed: 111 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
0 commit comments