Commit 01306f3
feat(adapter): allow groupBy without groupByInterval (dim-only aggregate)
Lets callers ask for a flat top-N table — sum(value) grouped by
dimensions only, no time bucketing. Same find() entry point routes
through findAggregatedFromTable when either groupByInterval OR
groupBy is present.
SQL shape with time bucketing (existing):
SELECT metric, sum(value), toStartOfInterval(time, INTERVAL …) bucket, dims
FROM events GROUP BY metric, bucket, dims ORDER BY bucket ASC
New dim-only shape:
SELECT metric, sum(value), dims
FROM events GROUP BY metric, dims ORDER BY value DESC
Default ORDER BY flips with the mode (chronological for time series,
top-N for tables). Caller-supplied orderBy('time') without bucketing
throws — the column isn't in the SELECT after GROUP BY.
Database adapter validation similarly relaxed; the parent's existing
"groupBy attribute whitelist" check stays.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 07b44b9 commit 01306f3
3 files changed
Lines changed: 60 additions & 52 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1588 | 1588 | | |
1589 | 1589 | | |
1590 | 1590 | | |
1591 | | - | |
1592 | | - | |
1593 | | - | |
1594 | | - | |
1595 | | - | |
1596 | | - | |
| 1591 | + | |
| 1592 | + | |
| 1593 | + | |
1597 | 1594 | | |
1598 | 1595 | | |
1599 | 1596 | | |
| |||
1662 | 1659 | | |
1663 | 1660 | | |
1664 | 1661 | | |
1665 | | - | |
1666 | | - | |
1667 | | - | |
| 1662 | + | |
1668 | 1663 | | |
1669 | 1664 | | |
1670 | 1665 | | |
1671 | 1666 | | |
1672 | 1667 | | |
1673 | 1668 | | |
1674 | | - | |
1675 | | - | |
1676 | | - | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
| 1678 | + | |
1677 | 1679 | | |
1678 | 1680 | | |
1679 | 1681 | | |
| |||
1691 | 1693 | | |
1692 | 1694 | | |
1693 | 1695 | | |
1694 | | - | |
1695 | | - | |
1696 | | - | |
1697 | | - | |
1698 | | - | |
1699 | | - | |
1700 | | - | |
1701 | | - | |
1702 | | - | |
1703 | | - | |
1704 | | - | |
1705 | | - | |
1706 | | - | |
1707 | | - | |
1708 | | - | |
1709 | | - | |
| 1696 | + | |
| 1697 | + | |
| 1698 | + | |
| 1699 | + | |
| 1700 | + | |
| 1701 | + | |
| 1702 | + | |
| 1703 | + | |
| 1704 | + | |
| 1705 | + | |
| 1706 | + | |
| 1707 | + | |
| 1708 | + | |
| 1709 | + | |
| 1710 | + | |
| 1711 | + | |
| 1712 | + | |
| 1713 | + | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
| 1717 | + | |
| 1718 | + | |
| 1719 | + | |
| 1720 | + | |
| 1721 | + | |
| 1722 | + | |
| 1723 | + | |
| 1724 | + | |
| 1725 | + | |
| 1726 | + | |
1710 | 1727 | | |
1711 | 1728 | | |
1712 | 1729 | | |
1713 | 1730 | | |
1714 | 1731 | | |
1715 | 1732 | | |
1716 | | - | |
| 1733 | + | |
1717 | 1734 | | |
1718 | | - | |
| 1735 | + | |
1719 | 1736 | | |
1720 | 1737 | | |
1721 | 1738 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
495 | 495 | | |
496 | 496 | | |
497 | 497 | | |
498 | | - | |
499 | | - | |
| 498 | + | |
500 | 499 | | |
501 | 500 | | |
502 | 501 | | |
503 | 502 | | |
504 | 503 | | |
505 | 504 | | |
506 | | - | |
507 | | - | |
508 | 505 | | |
509 | 506 | | |
510 | 507 | | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
| 508 | + | |
515 | 509 | | |
516 | 510 | | |
517 | 511 | | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | 512 | | |
524 | 513 | | |
525 | 514 | | |
| |||
528 | 517 | | |
529 | 518 | | |
530 | 519 | | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
535 | 520 | | |
536 | 521 | | |
537 | 522 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
652 | 652 | | |
653 | 653 | | |
654 | 654 | | |
655 | | - | |
| 655 | + | |
656 | 656 | | |
657 | | - | |
658 | | - | |
659 | | - | |
660 | | - | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
664 | 670 | | |
665 | 671 | | |
0 commit comments