Commit 56ecc8d
committed
Address Copilot review on #23128: reject negative FixedSizeList size, drop per-compare allocation in equal_to
Four Copilot inline comments handled together:
* `group_column_supported_type` and `make_group_column` both now reject
`FixedSizeList` with a negative `list_size`. Arrow defines that size
as non-negative, but the enum lets callers construct a negative value
programmatically; without this guard the `i32 as usize` cast inside
the builder would wrap and risk panics / OOM. Guards are duplicated
on both sides so direct callers of `make_group_column` (and the
`supported_schema` planner gate) both fail safely. Consistency fuzz
already covers the `make_group_column` side via the existing
unsupported_cases path; an explicit dedicated test below covers both
surfaces.
* `FixedSizeListGroupValueBuilder::new` asserts `list_len >= 0` so any
direct construction that bypasses the factory fails fast with a
clear message instead of silently producing a broken builder.
`list_len_usize` now uses `usize::try_from(...).expect(...)` instead
of `as usize`; with the constructor's assertion the conversion is
provably infallible, but going through `try_from` means a future
invariant break shows up as an explicit panic rather than a silent
wrap.
* `equal_to` no longer calls `list_array.value(rhs_row)`, which
constructs a sliced child `ArrayRef` on every comparison. The hot
path now borrows `list_array.values()` and uses `value_offset(rhs_row)`
to compute the child base index, mirroring the existing approach in
`append_val`. Zero allocations per equality check.
New test: `negative_list_size_is_rejected_by_allow_list_and_dispatcher`
locks in the negative-size guard at both surfaces. 13/13 FSL tests
pass, 128/128 aggregates pass, clippy clean.1 parent ecdd425 commit 56ecc8d
2 files changed
Lines changed: 78 additions & 5 deletions
File tree
- datafusion/physical-plan/src/aggregates/group_values/multi_group_by
Lines changed: 58 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
63 | 72 | | |
64 | 73 | | |
65 | 74 | | |
| |||
70 | 79 | | |
71 | 80 | | |
72 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
73 | 87 | | |
74 | | - | |
| 88 | + | |
| 89 | + | |
75 | 90 | | |
76 | 91 | | |
77 | 92 | | |
| |||
91 | 106 | | |
92 | 107 | | |
93 | 108 | | |
94 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
95 | 114 | | |
96 | 115 | | |
| 116 | + | |
97 | 117 | | |
98 | | - | |
| 118 | + | |
99 | 119 | | |
100 | 120 | | |
101 | 121 | | |
| |||
417 | 437 | | |
418 | 438 | | |
419 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 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 | + | |
420 | 475 | | |
421 | 476 | | |
422 | 477 | | |
| |||
Lines changed: 20 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
926 | 926 | | |
927 | 927 | | |
928 | 928 | | |
929 | | - | |
| 929 | + | |
| 930 | + | |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
930 | 938 | | |
931 | 939 | | |
932 | 940 | | |
| |||
1087 | 1095 | | |
1088 | 1096 | | |
1089 | 1097 | | |
1090 | | - | |
| 1098 | + | |
| 1099 | + | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
| 1108 | + | |
1091 | 1109 | | |
1092 | 1110 | | |
1093 | 1111 | | |
| |||
0 commit comments