Commit 42667ca
committed
Fix off-by-one in split_chunk upper bound
split_chunk() splits a chunk [start, end) into [start, split_at) and
[split_at, end). Per the invariant documented in the code, both
resulting ranges must have length at least 1, so the valid split points
are [start + 1, end - 1].
The lower bound was correct, but the upper bound required the right
range to have length at least 2. This rejected split_at = end - 1 (a
valid length-1 right range) and made a chunk of width 2 unsplittable via
an explicit split_at, even though the default midpoint path picks and
accepts that same point for a width-2 chunk.
Allow split points up to end - 1 so the bounds are symmetric and match
the documented invariant. Empty-range splits remain rejected.1 parent 35b093b commit 42667ca
4 files changed
Lines changed: 26 additions & 1 deletion
File tree
- .unreleased
- tsl
- src
- test
- expected
- sql
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1125 | 1125 | | |
1126 | 1126 | | |
1127 | 1127 | | |
1128 | | - | |
| 1128 | + | |
1129 | 1129 | | |
1130 | 1130 | | |
1131 | 1131 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1175 | 1175 | | |
1176 | 1176 | | |
1177 | 1177 | | |
| 1178 | + | |
| 1179 | + | |
| 1180 | + | |
| 1181 | + | |
| 1182 | + | |
| 1183 | + | |
| 1184 | + | |
| 1185 | + | |
| 1186 | + | |
| 1187 | + | |
| 1188 | + | |
| 1189 | + | |
| 1190 | + | |
| 1191 | + | |
| 1192 | + | |
| 1193 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
748 | 748 | | |
749 | 749 | | |
750 | 750 | | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
0 commit comments