Repository navigation
Commit fc1cea6
feat: add GroupColumn support for Float16 in multi-column GROUP BY (apache#23785)
## 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. A `Float16` key triggers exactly that today.
`Float16` reuses the existing `PrimitiveGroupValueBuilder` with no new
builder
type: its native `half::f16` already implements the `HashValue`
canonicalization (`hash_float!(f16, f32, f64)`), so `-0.0`/`+0.0`
folding and
`NaN` grouping match `Float32`/`Float64` with no extra handling.
## What changes are included in this PR?
- Accept `Float16` in `group_column_supported_type` and dispatch it in
`make_group_column`.
- Move `Float16` from the rejected to the accepted set in the
`group_column_supported_type` ↔ `make_group_column` consistency fuzz,
and
repoint the two tests that used `Float16` as their stock "unsupported"
example
to a permanently-invalid unit combo (`Time64(Second)`), so they stay
stable as
sibling primitive builders (Decimal256, Interval, …) land independently.
- Add a `(Float16, Int32)` group-count benchmark to
`benches/multi_group_by.rs`
(capped below f16's ~63.5k distinct finite values).
## Are these changes tested?
Yes.
- New unit test `test_group_values_column_float16`: a `(Float16, Int32)`
key
stays on the `GroupValuesColumn` path, dedups including nulls, folds
`-0.0`/`+0.0` into one group (stored as `+0.0`), groups equal `NaN`s,
keeps
`(0.0, 4)` distinct from `(±0.0, 3)` via the `Int32` key, and
round-trips
with the `Float16` output type preserved.
- The consistency fuzz now asserts `Float16` routes through the
dispatcher.
- New single- and multi-column `Float16` `GROUP BY` coverage in
`group_by.slt`.
## Are there any user-facing changes?
No API changes. `GROUP BY` queries with a `Float16` key now use the
column-wise
fast path instead of the row-encoded fallback; results are unchanged.
---------
Co-authored-by: tohuya6 <[email protected]>
Co-authored-by: Andrew Lamb <[email protected]>1 parent 83a1d66 commit fc1cea6
3 files changed
Lines changed: 203 additions & 15 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 | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
31 | 33 | | |
32 | 34 | | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
37 | 39 | | |
| 40 | + | |
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| |||
444 | 447 | | |
445 | 448 | | |
446 | 449 | | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
447 | 539 | | |
448 | 540 | | |
449 | 541 | | |
| |||
537 | 629 | | |
538 | 630 | | |
539 | 631 | | |
| 632 | + | |
540 | 633 | | |
541 | 634 | | |
542 | 635 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| |||
945 | 946 | | |
946 | 947 | | |
947 | 948 | | |
| 949 | + | |
948 | 950 | | |
949 | 951 | | |
950 | 952 | | |
| |||
999 | 1001 | | |
1000 | 1002 | | |
1001 | 1003 | | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
1002 | 1007 | | |
1003 | 1008 | | |
1004 | 1009 | | |
| |||
1295 | 1300 | | |
1296 | 1301 | | |
1297 | 1302 | | |
1298 | | - | |
1299 | | - | |
| 1303 | + | |
| 1304 | + | |
1300 | 1305 | | |
1301 | 1306 | | |
1302 | 1307 | | |
| |||
1581 | 1586 | | |
1582 | 1587 | | |
1583 | 1588 | | |
| 1589 | + | |
1584 | 1590 | | |
1585 | 1591 | | |
1586 | 1592 | | |
| |||
1616 | 1622 | | |
1617 | 1623 | | |
1618 | 1624 | | |
1619 | | - | |
1620 | 1625 | | |
1621 | 1626 | | |
1622 | 1627 | | |
| |||
1694 | 1699 | | |
1695 | 1700 | | |
1696 | 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 | + | |
| 1727 | + | |
| 1728 | + | |
| 1729 | + | |
| 1730 | + | |
| 1731 | + | |
| 1732 | + | |
| 1733 | + | |
| 1734 | + | |
| 1735 | + | |
| 1736 | + | |
| 1737 | + | |
| 1738 | + | |
| 1739 | + | |
| 1740 | + | |
| 1741 | + | |
| 1742 | + | |
| 1743 | + | |
| 1744 | + | |
| 1745 | + | |
| 1746 | + | |
| 1747 | + | |
| 1748 | + | |
| 1749 | + | |
| 1750 | + | |
| 1751 | + | |
| 1752 | + | |
| 1753 | + | |
| 1754 | + | |
| 1755 | + | |
| 1756 | + | |
| 1757 | + | |
| 1758 | + | |
| 1759 | + | |
| 1760 | + | |
1697 | 1761 | | |
1698 | 1762 | | |
1699 | | - | |
1700 | | - | |
| 1763 | + | |
| 1764 | + | |
1701 | 1765 | | |
1702 | 1766 | | |
1703 | 1767 | | |
1704 | | - | |
| 1768 | + | |
| 1769 | + | |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
1705 | 1773 | | |
1706 | 1774 | | |
1707 | 1775 | | |
| |||
1720 | 1788 | | |
1721 | 1789 | | |
1722 | 1790 | | |
1723 | | - | |
1724 | | - | |
| 1791 | + | |
| 1792 | + | |
| 1793 | + | |
| 1794 | + | |
| 1795 | + | |
1725 | 1796 | | |
1726 | 1797 | | |
1727 | 1798 | | |
| |||
1808 | 1879 | | |
1809 | 1880 | | |
1810 | 1881 | | |
1811 | | - | |
| 1882 | + | |
1812 | 1883 | | |
1813 | 1884 | | |
1814 | 1885 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5721 | 5721 | | |
5722 | 5722 | | |
5723 | 5723 | | |
| 5724 | + | |
| 5725 | + | |
| 5726 | + | |
| 5727 | + | |
| 5728 | + | |
| 5729 | + | |
| 5730 | + | |
| 5731 | + | |
| 5732 | + | |
| 5733 | + | |
| 5734 | + | |
| 5735 | + | |
| 5736 | + | |
| 5737 | + | |
| 5738 | + | |
| 5739 | + | |
| 5740 | + | |
| 5741 | + | |
| 5742 | + | |
| 5743 | + | |
| 5744 | + | |
| 5745 | + | |
| 5746 | + | |
| 5747 | + | |
0 commit comments