Repository navigation
Commit 7b4ccd0
feat: add GroupColumn support for Interval in multi-column GROUP BY (apache#23786)
## Which issue does this PR close?
- Part of apache#22715.
## Rationale for this change
`multi_group_by::group_column_supported_type` gates which GROUP BY
columns may
use the column-wise `GroupValuesColumn` fast path, and the gate is
all-or-nothing: a single unsupported column forces the **entire**
grouping onto
the byte-encoded `GroupValuesRows` fallback, even when every other key
column
would have qualified. An `Interval` key triggers exactly that today.
All three `Interval` units reuse the existing
`PrimitiveGroupValueBuilder` with
no new builder type and no new `HashValue` impl — the `i32` /
`IntervalDayTime`
/ `IntervalMonthDayNano` natives already implement it.
## What changes are included in this PR?
- Dispatch the three `Interval*Type` units in `make_group_column`.
`IntervalUnit`
has exactly three variants, so the match is exhaustive with no fallback
arm
(unlike `Time32`/`Time64`, which must reject invalid unit combinations).
- Accept `Interval(_)` in `group_column_supported_type`.
- Extend the `group_column_supported_type` ↔ `make_group_column`
consistency
fuzz with the three Interval units.
- Add an `(Interval, Int32)` group-count benchmark to
`benches/multi_group_by.rs`.
## Are these changes tested?
Yes.
- New unit test: an `Interval` key stays on the `GroupValuesColumn`
path, dedups
including nulls, keeps "1 month" and "30 days" as **distinct** groups
(no
cross-unit folding), and round-trips with the `Interval` output type
preserved.
- The consistency fuzz now asserts all three Interval units route
through the
dispatcher.
- New single- and multi-column `Interval` `GROUP BY` coverage in
`group_by.slt`.
## Are there any user-facing changes?
No API changes. `GROUP BY` queries with an `Interval` key now use the
column-wise fast path instead of the row-encoded fallback; results are
unchanged.
---------
Co-authored-by: tohuya6 <[email protected]>1 parent 9ab4509 commit 7b4ccd0
3 files changed
Lines changed: 198 additions & 4 deletions
File tree
- datafusion
- physical-plan
- benches
- src/aggregates/group_values/multi_group_by
- sqllogictest/test_files
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | | - | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
620 | 623 | | |
621 | 624 | | |
622 | 625 | | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 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 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
623 | 712 | | |
624 | 713 | | |
625 | 714 | | |
| |||
631 | 720 | | |
632 | 721 | | |
633 | 722 | | |
| 723 | + | |
634 | 724 | | |
635 | 725 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
967 | 968 | | |
968 | 969 | | |
969 | 970 | | |
| 971 | + | |
970 | 972 | | |
971 | 973 | | |
972 | 974 | | |
| |||
1063 | 1065 | | |
1064 | 1066 | | |
1065 | 1067 | | |
| 1068 | + | |
| 1069 | + | |
| 1070 | + | |
| 1071 | + | |
| 1072 | + | |
| 1073 | + | |
| 1074 | + | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
| 1079 | + | |
| 1080 | + | |
1066 | 1081 | | |
1067 | 1082 | | |
1068 | 1083 | | |
| |||
1301 | 1316 | | |
1302 | 1317 | | |
1303 | 1318 | | |
1304 | | - | |
| 1319 | + | |
1305 | 1320 | | |
1306 | 1321 | | |
1307 | 1322 | | |
| |||
1606 | 1621 | | |
1607 | 1622 | | |
1608 | 1623 | | |
| 1624 | + | |
| 1625 | + | |
| 1626 | + | |
1609 | 1627 | | |
1610 | 1628 | | |
1611 | 1629 | | |
| |||
1758 | 1776 | | |
1759 | 1777 | | |
1760 | 1778 | | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
| 1782 | + | |
| 1783 | + | |
| 1784 | + | |
| 1785 | + | |
| 1786 | + | |
| 1787 | + | |
| 1788 | + | |
| 1789 | + | |
| 1790 | + | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
| 1796 | + | |
| 1797 | + | |
| 1798 | + | |
| 1799 | + | |
| 1800 | + | |
| 1801 | + | |
| 1802 | + | |
| 1803 | + | |
| 1804 | + | |
| 1805 | + | |
| 1806 | + | |
| 1807 | + | |
| 1808 | + | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
| 1814 | + | |
| 1815 | + | |
| 1816 | + | |
| 1817 | + | |
| 1818 | + | |
| 1819 | + | |
| 1820 | + | |
| 1821 | + | |
| 1822 | + | |
| 1823 | + | |
| 1824 | + | |
| 1825 | + | |
| 1826 | + | |
| 1827 | + | |
| 1828 | + | |
| 1829 | + | |
| 1830 | + | |
| 1831 | + | |
| 1832 | + | |
| 1833 | + | |
| 1834 | + | |
| 1835 | + | |
| 1836 | + | |
| 1837 | + | |
1761 | 1838 | | |
1762 | 1839 | | |
1763 | 1840 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5745 | 5745 | | |
5746 | 5746 | | |
5747 | 5747 | | |
| 5748 | + | |
| 5749 | + | |
| 5750 | + | |
| 5751 | + | |
| 5752 | + | |
| 5753 | + | |
| 5754 | + | |
| 5755 | + | |
| 5756 | + | |
| 5757 | + | |
| 5758 | + | |
| 5759 | + | |
| 5760 | + | |
| 5761 | + | |
| 5762 | + | |
| 5763 | + | |
| 5764 | + | |
| 5765 | + | |
| 5766 | + | |
| 5767 | + | |
| 5768 | + | |
| 5769 | + | |
| 5770 | + | |
| 5771 | + | |
| 5772 | + | |
| 5773 | + | |
| 5774 | + | |
0 commit comments