Commit 281f2e2
authored
Query the current aggregation bucket (#6293)
* graph, graphql: apply default order on the build_order call
This makes sure that when the default order is applied the
column used in ORDER BY is also included in the SELECT projection
* graph, graphql, store: support querying the current bucket
* docs: update the aggregation docs
* store: add unit tests for select_current_sql generation
Add expected SQL constants and check_eqv assertions for select_current_sql
in the existing rollup() test function, covering all 5 aggregation types:
Stats (with dimensions), TotalStats (no dimensions), OpenClose (first/last),
Lifetime (cumulative), and CountOnly (count-only).
* store: add GROUP BY timestamp to select_current_bucket
Fix select_current_bucket to always include GROUP BY timestamp in
the generated SQL, regardless of whether dimensions are present.
* store: add store-level tests for root current bucket queries
Added 4 test functions exercising the current aggregation bucket feature
through the store's find method: current_include (verifies 6 rows with
rolled-up + on-the-fly current bucket data), current_exclude (4 rolled-up
rows only), current_include_with_filter (dimension filter on TOKEN1),
and current_include_cumulative (totalValue cumulative aggregates).
Added TestEnv helper methods (aggregation_query, find_aggregation) for
constructing EntityQuery with explicit column selection and configurable
AggregationCurrent. Adjusted TIMES[3] from minutes(120) to minutes(121)
to ensure source data falls past the last_rollup boundary (max_agg_ts +
interval + 1s).
* store, graphql: extend current bucket support to nested aggregation queries
Extend the current aggregation bucket querying to work for nested
aggregation fields accessed through parent entities (SingleWindow path).
Changes:
- Remove forced aggregation_current = None for nested queries in prefetch.rs
- Extend find_rollup to handle FilterCollection::SingleWindow
- Extend query_window_one_entity to UNION ALL current bucket data with
windowed aggregation data, using the dimension/link column to map
current bucket rows to parent IDs
* store: add store-level tests for nested current bucket queries
Added 4 test functions for nested aggregation current bucket queries
using EntityCollection::Window (Token parent, Stats_hour child):
- nested_current_include: 6 rows with aggregate value verification
- nested_current_exclude: 4 rolled-up rows only
- nested_current_include_empty_bucket: TOKEN3 with no data returns 0 rows
- nested_current_include_count: 3 rows per token
Extended SCHEMA with Token entity, changed Data.token and Stats.token
from Bytes! to Token!, added insert_entities helper for multi-type
entity insertion, and inserted TOKEN1/TOKEN2/TOKEN3 entities in test data.
* tests: add runner test for current aggregation bucket end-to-end
* docs: update aggregation docs to fully document current bucket feature
Documentation does not cover Parent-linked nested query limitation or
SELECT * constraint
* chore: ignore .pnpm-store directory
* store: update instrospection mock
* store: fix identation of example SQL
They were treated as doctests
* store: use inline FILTER comment, do not group by timestamp1 parent 197dc5a commit 281f2e2
File tree
21 files changed
+3289
-85
lines changed- docs
- graphql/src
- execution
- store
- graph/src
- components/store
- schema
- input
- store
- postgres/src
- relational
- test-store/tests
- graphql
- postgres
- tests
- runner-tests/aggregation-current-bucket
- abis
- src
- tests
21 files changed
+3289
-85
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
182 | | - | |
| 181 | + | |
| 182 | + | |
183 | 183 | | |
184 | 184 | | |
185 | 185 | | |
| |||
189 | 189 | | |
190 | 190 | | |
191 | 191 | | |
192 | | - | |
| 192 | + | |
193 | 193 | | |
194 | 194 | | |
195 | 195 | | |
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
466 | 466 | | |
467 | 467 | | |
468 | 468 | | |
| 469 | + | |
| 470 | + | |
469 | 471 | | |
470 | 472 | | |
471 | 473 | | |
| |||
484 | 486 | | |
485 | 487 | | |
486 | 488 | | |
| 489 | + | |
487 | 490 | | |
488 | 491 | | |
489 | 492 | | |
| |||
543 | 546 | | |
544 | 547 | | |
545 | 548 | | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
546 | 562 | | |
547 | 563 | | |
548 | 564 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
703 | 703 | | |
704 | 704 | | |
705 | 705 | | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
706 | 711 | | |
707 | 712 | | |
708 | 713 | | |
| |||
2231 | 2236 | | |
2232 | 2237 | | |
2233 | 2238 | | |
| 2239 | + | |
| 2240 | + | |
2234 | 2241 | | |
2235 | 2242 | | |
2236 | 2243 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
51 | 51 | | |
52 | 52 | | |
53 | 53 | | |
| 54 | + | |
54 | 55 | | |
55 | 56 | | |
56 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| |||
364 | 364 | | |
365 | 365 | | |
366 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
367 | 387 | | |
368 | 388 | | |
369 | 389 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| |||
626 | 626 | | |
627 | 627 | | |
628 | 628 | | |
| 629 | + | |
629 | 630 | | |
630 | 631 | | |
631 | 632 | | |
| |||
644 | 645 | | |
645 | 646 | | |
646 | 647 | | |
| 648 | + | |
647 | 649 | | |
648 | 650 | | |
649 | 651 | | |
| |||
652 | 654 | | |
653 | 655 | | |
654 | 656 | | |
655 | | - | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
656 | 661 | | |
657 | 662 | | |
658 | 663 | | |
| |||
696 | 701 | | |
697 | 702 | | |
698 | 703 | | |
| 704 | + | |
699 | 705 | | |
700 | 706 | | |
701 | 707 | | |
| |||
715 | 721 | | |
716 | 722 | | |
717 | 723 | | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | 724 | | |
724 | 725 | | |
725 | 726 | | |
| |||
728 | 729 | | |
729 | 730 | | |
730 | 731 | | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
731 | 736 | | |
732 | 737 | | |
733 | 738 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| 15 | + | |
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| |||
552 | 553 | | |
553 | 554 | | |
554 | 555 | | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
555 | 564 | | |
556 | 565 | | |
557 | 566 | | |
| |||
0 commit comments